From 1ee16b02d54bd8c71ae365bdb56d7389702839ea Mon Sep 17 00:00:00 2001 From: matt handler Date: Tue, 26 Apr 2011 17:21:39 -0400 Subject: sort topics when popping out of the database, customize photoview controller, need to add sharekit --- Classes/PhotoViewController.m | 53 ++++++++++++++++++++++++ Classes/TopicsViewController.m | 91 +++++++++++++++++++----------------------- 2 files changed, 94 insertions(+), 50 deletions(-) (limited to 'Classes') diff --git a/Classes/PhotoViewController.m b/Classes/PhotoViewController.m index 1b43094..151aabd 100644 --- a/Classes/PhotoViewController.m +++ b/Classes/PhotoViewController.m @@ -8,6 +8,59 @@ #import "PhotoViewController.h" #import "PhotoSource.h" +#import + +@interface MyPhotoViewController : TTPhotoViewController +{ + +} +@end + +@implementation MyPhotoViewController + +-(void)viewDidLoad{ + // New item to be added + UIBarButtonItem *shareItem = [[UIBarButtonItem alloc] + initWithTitle:@"Share" style:UIBarButtonItemStyleBordered target:self + action:@selector(action:)]; + UIBarButtonItem *customItem = [[UIBarButtonItem alloc] + initWithTitle:@"Save" style:UIBarButtonItemStyleBordered target:self + action:@selector(action:)]; + // Flex space to keep the back / forward arrows centered + UIBarButtonItem *flex = [[UIBarButtonItem alloc] + initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace + target:nil action:nil]; + UIBarButtonItem *flex2 = [[UIBarButtonItem alloc] + initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace + target:nil action:nil]; + // Create array with items starting with the left side + NSMutableArray *items = [NSMutableArray arrayWithObject:shareItem]; + [items addObject:flex]; + // Then add the current items (the back / forward arrows) + [items addObjectsFromArray:[_toolbar items]]; + [items addObject:flex2]; + // Add in our new item to the far right + [items addObject:customItem]; + [_toolbar setItems:items]; + [shareItem release]; + [customItem release]; + [flex release]; + [flex2 release]; +} + +-(void)action:(id)sender{ + // Perform your action +} + +@end + + +@implementation TTThumbsViewController (test) +- (TTPhotoViewController*)createPhotoViewController { + NSLog(@"test"); + return (TTPhotoViewController *)[[[MyPhotoViewController alloc] init] autorelease]; +} +@end @implementation PhotoViewController diff --git a/Classes/TopicsViewController.m b/Classes/TopicsViewController.m index 1d93566..78258d7 100644 --- a/Classes/TopicsViewController.m +++ b/Classes/TopicsViewController.m @@ -31,18 +31,9 @@ [super viewDidLoad]; NSLog(@"viewDidLoad"); self.tableView.rowHeight = 100; - //UIBarButtonItem *doneItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(returnToParserChoices)] autorelease]; - //self.navigationItem.rightBarButtonItem = doneItem; - // Create the object manager objMan = [[HJObjManager alloc] initWithLoadingBufferSize:6 memCacheSize:20]; - //if you are using for full screen images, you'll need a smaller memory cache than the defaults, - //otherwise the cached images will get you out of memory quickly - //objMan = [[HJObjManager alloc] initWithLoadingBufferSize:6 memCacheSize:1]; - - // Create a file cache for the object manager to use - // A real app might do this durring startup, allowing the object manager and cache to be shared by several screens NSString* cacheDirectory = [NSHomeDirectory() stringByAppendingString:@"/Library/Caches/imgcache/icons/"] ; HJMOFileCache* fileCache = [[[HJMOFileCache alloc] initWithRootPath:cacheDirectory] autorelease]; objMan.fileCache = fileCache; @@ -67,7 +58,7 @@ - (void) getTopicsFromDb { // grab topics [db open]; - FMResultSet *fResult = [db executeQuery:@"SELECT * FROM picCasts"]; //order by date, limite _max + FMResultSet *fResult = [db executeQuery:@"SELECT * FROM picCasts ORDER BY releaseDate DESC"]; //order by date, limite _max // put into sections while([fResult next]) @@ -115,46 +106,6 @@ return photoViewController; } -#pragma mark - -#pragma mark View lifecycle - -/* -- (void)viewDidLoad { - [super viewDidLoad]; - - // Uncomment the following line to display an Edit button in the navigation bar for this view controller. - // self.navigationItem.rightBarButtonItem = self.editButtonItem; -} -*/ - -/* -- (void)viewWillAppear:(BOOL)animated { - [super viewWillAppear:animated]; -} -*/ -/* -- (void)viewDidAppear:(BOOL)animated { - [super viewDidAppear:animated]; -} -*/ -/* -- (void)viewWillDisappear:(BOOL)animated { - [super viewWillDisappear:animated]; -} -*/ -/* -- (void)viewDidDisappear:(BOOL)animated { - [super viewDidDisappear:animated]; -} -*/ -/* -// Override to allow orientations other than the default portrait orientation. -- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - // Return YES for supported orientations. - return (interfaceOrientation == UIInterfaceOrientationPortrait); -} -*/ - #pragma mark - #pragma mark custom sheeyit @@ -352,6 +303,46 @@ } +#pragma mark - +#pragma mark View lifecycle + +/* + - (void)viewDidLoad { + [super viewDidLoad]; + + // Uncomment the following line to display an Edit button in the navigation bar for this view controller. + // self.navigationItem.rightBarButtonItem = self.editButtonItem; + } + */ + +/* + - (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + } + */ +/* + - (void)viewDidAppear:(BOOL)animated { + [super viewDidAppear:animated]; + } + */ +/* + - (void)viewWillDisappear:(BOOL)animated { + [super viewWillDisappear:animated]; + } + */ +/* + - (void)viewDidDisappear:(BOOL)animated { + [super viewDidDisappear:animated]; + } + */ +/* + // Override to allow orientations other than the default portrait orientation. + - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { + // Return YES for supported orientations. + return (interfaceOrientation == UIInterfaceOrientationPortrait); + } + */ + #pragma mark Implementation - (void)startParsing { -- cgit v1.2.3