Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbd5ad01

Browse files
author
Jim Puls
committed
Better explain different ways of getting images.
1 parent5d5869d commitbd5ad01

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

‎CodeGenTestApp/CGTAMasterViewController.m

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,16 @@ - (IBAction)sliderValueChanged:(UISlider *)sender;
5858

5959
- (NSArray *)flagImages;
6060
{
61-
// return @[[UIImage imageNamed:@"USA"], [UIImage imageNamed:@"Canada"], [UIImage imageNamed:@"UK"], [UIImage imageNamed:@"Austrlia"]];
62-
// return @[[CGTAImagesCatalog usaImage], [CGTAImagesCatalog canadaImage], [CGTAImagesCatalog ukImage], [CGTAImagesCatalog australiaImage]];
61+
NSArray *allFlagImages =nil;
62+
63+
// Initial version: full of strings that you have to type correctly!
64+
// Misspell any of these and your app will crash on trying to add `nil` to an array.
65+
allFlagImages = @[[UIImageimageNamed:@"USA"], [UIImageimageNamed:@"Canada"], [UIImageimageNamed:@"UK"], [UIImageimageNamed:@"Australia"]];
66+
67+
// New version: get the properly compiler-checked spelling from the image catalog.
68+
allFlagImages = @[[CGTAImagesCatalogusaImage], [CGTAImagesCatalogcanadaImage], [CGTAImagesCatalogukImage], [CGTAImagesCatalogaustraliaImage]];
69+
70+
// But really, why not use a little runtime hackery because we can?
6371
return [CGTAImagesCatalogallImages];
6472
}
6573

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp