Skip to content

Commit

Permalink
Added default images. Added activity indicator.
Browse files Browse the repository at this point in the history
  • Loading branch information
kirbyt committed Mar 6, 2011
1 parent d5726be commit 7cc0c7b
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
Expand Up @@ -7,6 +7,8 @@
objects = {

/* Begin PBXBuildFile section */
68112CDA1323F5F800C808D1 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 68112CD81323F5F800C808D1 /* Default.png */; };
68112CDB1323F5F800C808D1 /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 68112CD91323F5F800C808D1 /* Default@2x.png */; };
689D24DF1322CF8B00A08DEC /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 689D24DE1322CF8B00A08DEC /* UIKit.framework */; };
689D24E11322CF8B00A08DEC /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 689D24E01322CF8B00A08DEC /* Foundation.framework */; };
689D24E31322CF8B00A08DEC /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 689D24E21322CF8B00A08DEC /* CoreGraphics.framework */; };
Expand Down Expand Up @@ -47,6 +49,8 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
68112CD81323F5F800C808D1 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = "<group>"; };
68112CD91323F5F800C808D1 /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = "<group>"; };
689D24DA1322CF8B00A08DEC /* Flickr+JSONSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Flickr+JSONSample.app"; sourceTree = BUILT_PRODUCTS_DIR; };
689D24DE1322CF8B00A08DEC /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
689D24E01322CF8B00A08DEC /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -198,6 +202,8 @@
689D24E71322CF8B00A08DEC /* InfoPlist.strings */,
689D24EA1322CF8B00A08DEC /* Prefix.pch */,
689D24EB1322CF8B00A08DEC /* main.m */,
68112CD81323F5F800C808D1 /* Default.png */,
68112CD91323F5F800C808D1 /* Default@2x.png */,
);
name = "Supporting Files";
sourceTree = "<group>";
Expand Down Expand Up @@ -326,6 +332,8 @@
68DBE46F1323D2D200047944 /* LICENSE in Resources */,
68DBE4701323D2D200047944 /* README.md in Resources */,
68DBE47C1323D32800047944 /* photoDefault.png in Resources */,
68112CDA1323F5F800C808D1 /* Default.png in Resources */,
68112CDB1323F5F800C808D1 /* Default@2x.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 20 additions & 3 deletions src/Flickr+JSONSample/Flickr+JSONSample/RootViewController.m
Expand Up @@ -10,30 +10,47 @@
#import "FlickrPhotosDataSource.h"

@interface RootViewController ()
@property (nonatomic, retain) UIActivityIndicatorView *activityIndicator;
- (FlickrPhotosDataSource *)photos;
@end

@implementation RootViewController

@synthesize activityIndicator = activityIndicator_;

- (void)dealloc
{
[photos_ release], photos_ = nil;
[activityIndicator_ release], activityIndicator_ = nil;
[super dealloc];
}

- (void)viewDidLoad
{
[super viewDidLoad];

[self setDataSource:[self photos]];
[self setTitle:[NSString stringWithFormat:@"%i Photos", [[self photos] numberOfPhotos]]];

UIActivityIndicatorView *activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
[activityIndicator setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin];
[activityIndicator setCenter:[[self view] center]];
[activityIndicator startAnimating];
[self setActivityIndicator:activityIndicator];
[activityIndicator release];

[[self view] addSubview:[self activityIndicator]];

// Label back button as "Back".
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Back", @"Back button title") style:UIBarButtonItemStylePlain target:nil action:nil];
[[self navigationItem] setBackBarButtonItem:backButton];
[backButton release];
}

- (void)viewDidAppear:(BOOL)animated
{
[self setDataSource:[self photos]];
[self setTitle:[NSString stringWithFormat:@"%i Photos", [[self photos] numberOfPhotos]]];
[[self activityIndicator] stopAnimating];
}

- (FlickrPhotosDataSource *)photos
{
if (photos_) {
Expand Down

0 comments on commit 7cc0c7b

Please sign in to comment.