Skip to content

Commit

Permalink
Added root view controller and Flickr data source shell class.
Browse files Browse the repository at this point in the history
  • Loading branch information
kirbyt committed Mar 5, 2011
1 parent 9110dd2 commit a21ff11
Show file tree
Hide file tree
Showing 7 changed files with 155 additions and 6 deletions.
12 changes: 12 additions & 0 deletions src/Flickr+JSONSample/Flickr+JSONSample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
689D250B1322D07F00A08DEC /* KTThumbsView.m in Sources */ = {isa = PBXBuildFile; fileRef = 689D25021322D07F00A08DEC /* KTThumbsView.m */; };
689D250C1322D07F00A08DEC /* KTThumbsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 689D25041322D07F00A08DEC /* KTThumbsViewController.m */; };
689D250D1322D07F00A08DEC /* KTThumbView.m in Sources */ = {isa = PBXBuildFile; fileRef = 689D25061322D07F00A08DEC /* KTThumbView.m */; };
689D25101322D19800A08DEC /* RootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 689D250F1322D19800A08DEC /* RootViewController.m */; };
689D25131322D34F00A08DEC /* FlickrPhotosDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 689D25121322D34F00A08DEC /* FlickrPhotosDataSource.m */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand Down Expand Up @@ -49,6 +51,10 @@
689D25041322D07F00A08DEC /* KTThumbsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KTThumbsViewController.m; sourceTree = "<group>"; };
689D25051322D07F00A08DEC /* KTThumbView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KTThumbView.h; sourceTree = "<group>"; };
689D25061322D07F00A08DEC /* KTThumbView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KTThumbView.m; sourceTree = "<group>"; };
689D250E1322D19800A08DEC /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = "<group>"; };
689D250F1322D19800A08DEC /* RootViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RootViewController.m; sourceTree = "<group>"; };
689D25111322D34E00A08DEC /* FlickrPhotosDataSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FlickrPhotosDataSource.h; sourceTree = "<group>"; };
689D25121322D34F00A08DEC /* FlickrPhotosDataSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FlickrPhotosDataSource.m; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -98,6 +104,10 @@
689D24F81322D07F00A08DEC /* KTPhotoBrowser */,
689D24ED1322CF8B00A08DEC /* AppDelegate.h */,
689D24EE1322CF8B00A08DEC /* AppDelegate.m */,
689D250E1322D19800A08DEC /* RootViewController.h */,
689D250F1322D19800A08DEC /* RootViewController.m */,
689D25111322D34E00A08DEC /* FlickrPhotosDataSource.h */,
689D25121322D34F00A08DEC /* FlickrPhotosDataSource.m */,
689D24F01322CF8B00A08DEC /* MainWindow.xib */,
689D24E51322CF8B00A08DEC /* Supporting Files */,
);
Expand Down Expand Up @@ -208,6 +218,8 @@
689D250B1322D07F00A08DEC /* KTThumbsView.m in Sources */,
689D250C1322D07F00A08DEC /* KTThumbsViewController.m in Sources */,
689D250D1322D07F00A08DEC /* KTThumbView.m in Sources */,
689D25101322D19800A08DEC /* RootViewController.m in Sources */,
689D25131322D34F00A08DEC /* FlickrPhotosDataSource.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
4 changes: 3 additions & 1 deletion src/Flickr+JSONSample/Flickr+JSONSample/AppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@

@interface AppDelegate : NSObject <UIApplicationDelegate>
{

@private
UIWindow *window_;
UINavigationController *navController_;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;
Expand Down
18 changes: 13 additions & 5 deletions src/Flickr+JSONSample/Flickr+JSONSample/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,24 @@
//

#import "AppDelegate.h"
#import "RootViewController.h"


@implementation AppDelegate


@synthesize window=_window;
@synthesize window=window_;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
RootViewController *rootViewController = [[RootViewController alloc] init];
navController_ = [[UINavigationController alloc] initWithRootViewController:rootViewController];
[rootViewController release];

[[self window] addSubview:[navController_ view]];

[self.window makeKeyAndVisible];
return YES;
return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application
Expand Down Expand Up @@ -61,8 +68,9 @@ - (void)applicationWillTerminate:(UIApplication *)application

- (void)dealloc
{
[_window release];
[super dealloc];
[navController_ release];
[window_ release];
[super dealloc];
}

@end
18 changes: 18 additions & 0 deletions src/Flickr+JSONSample/Flickr+JSONSample/FlickrPhotosDataSource.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// FlickrPhotosDataSource.h
// Flickr+JSONSample
//
// Created by Kirby Turner on 3/5/11.
// Copyright 2011 White Peak Software Inc. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "KTPhotoBrowserDataSource.h"


@interface FlickrPhotosDataSource : NSObject <KTPhotoBrowserDataSource>
{

}

@end
44 changes: 44 additions & 0 deletions src/Flickr+JSONSample/Flickr+JSONSample/FlickrPhotosDataSource.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//
// FlickrPhotosDataSource.m
// Flickr+JSONSample
//
// Created by Kirby Turner on 3/5/11.
// Copyright 2011 White Peak Software Inc. All rights reserved.
//

#import "FlickrPhotosDataSource.h"


@implementation FlickrPhotosDataSource

- (void)dealloc
{
[super dealloc];
}

- (id)init
{
self = [super init];
if (self) {

}
return self;
}

- (NSInteger)numberOfPhotos
{
return 0;
}

// Implement either these, for synchronous images…
- (UIImage *)imageAtIndex:(NSInteger)index
{
return nil;
}

- (UIImage *)thumbImageAtIndex:(NSInteger)index
{
return nil;
}

@end
20 changes: 20 additions & 0 deletions src/Flickr+JSONSample/Flickr+JSONSample/RootViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// RootViewController.h
// Flickr+JSONSample
//
// Created by Kirby Turner on 3/5/11.
// Copyright 2011 White Peak Software Inc. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "KTThumbsViewController.h"

@class FlickrPhotosDataSource;

@interface RootViewController : KTThumbsViewController
{
@private
FlickrPhotosDataSource *photos_;
}

@end
45 changes: 45 additions & 0 deletions src/Flickr+JSONSample/Flickr+JSONSample/RootViewController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//
// RootViewController.m
// Flickr+JSONSample
//
// Created by Kirby Turner on 3/5/11.
// Copyright 2011 White Peak Software Inc. All rights reserved.
//

#import "RootViewController.h"
#import "FlickrPhotosDataSource.h"

@interface RootViewController ()
- (FlickrPhotosDataSource *)photos;
@end

@implementation RootViewController

- (void)dealloc
{
[super dealloc];
}

- (void)viewDidLoad
{
[super viewDidLoad];

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

// 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];
}

- (FlickrPhotosDataSource *)photos
{
if (photos_) {
return photos_;
}

return nil;
}

@end

0 comments on commit a21ff11

Please sign in to comment.