From e993e7ba4e1107a875afeec33292b9d01c52035b Mon Sep 17 00:00:00 2001 From: matt handler Date: Sat, 30 Apr 2011 09:25:32 -0400 Subject: added loading animation, piccast color title, navigation controllers for browse and search, uicolor orange and yellow, custom headers for search view, redid loading screen, fixed backgroundGradient, background white for topic table, etc etc etc gay --- Classes/BrowseViewController.m | 8 ++++ Classes/BrowseViewController.xib | 74 +++-------------------------------- Classes/PhotoViewController.m | 48 +++++++++++++++++++++++ Classes/PicCastAppDelegate.m | 42 ++++++++++++++++++++ Classes/SearchViewController.m | 47 ++++++++++++++++++++-- Classes/SourcesEditViewController.xib | 37 ++++++++++++++---- Classes/TopicTableViewCell.m | 19 +++++++++ Classes/TopicsViewController.m | 18 +++++++++ 8 files changed, 213 insertions(+), 80 deletions(-) (limited to 'Classes') diff --git a/Classes/BrowseViewController.m b/Classes/BrowseViewController.m index 22742c7..ca39545 100644 --- a/Classes/BrowseViewController.m +++ b/Classes/BrowseViewController.m @@ -21,6 +21,14 @@ - (void)viewDidLoad { [super viewDidLoad]; + [self.navigationController.navigationBar drawLogo]; + + UIView *backgroundView = [[UIView alloc] initWithFrame:self.view.frame]; + backgroundView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"backgroundGradient.png"]]; + + self.tableView.backgroundView = backgroundView; + self.tableView.backgroundColor = [UIColor clearColor]; + // Uncomment the following line to display an Edit button in the navigation bar for this view controller. // self.navigationItem.rightBarButtonItem = self.editButtonItem; diff --git a/Classes/BrowseViewController.xib b/Classes/BrowseViewController.xib index 7baf5fb..022a284 100644 --- a/Classes/BrowseViewController.xib +++ b/Classes/BrowseViewController.xib @@ -45,7 +45,7 @@ 274 - {{0, 44}, {320, 387}} + {320, 387} 10 @@ -93,27 +93,8 @@ AAMAAAABAAEAAAFTAAMAAAAEAAACAgAAAAAACAAIAAgACAABAAEAAQABA 10 10 - - - 290 - {320, 44} - - IBCocoaTouchFramework - - 1 - MC4wOTMzOTc2Mzk2OSAwLjE3NTQ0MzM4MTEgMC4yNTAzODczMTEAA - - - YES - - - PicCast - IBCocoaTouchFramework - - - - {320, 431} + {320, 387} 3 @@ -122,6 +103,9 @@ AAMAAAABAAEAAAFTAAMAAAAEAAACAgAAAAAACAAIAAgACAABAAEAAQABA 2 + + NO + IBCocoaTouchFramework @@ -187,25 +171,10 @@ AAMAAAABAAEAAAFTAAMAAAAEAAACAgAAAAAACAAIAAgACAABAAEAAQABA YES - - - 9 - - - YES - - - - - - 10 - - - 4 @@ -219,20 +188,17 @@ AAMAAAABAAEAAAFTAAMAAAAEAAACAgAAAAAACAAIAAgACAABAAEAAQABA YES -1.CustomClassName -2.CustomClassName - 10.IBPluginDependency 4.IBEditorWindowLastContentRect 4.IBPluginDependency 4.IBViewBoundsToFrameTransform 8.IBEditorWindowLastContentRect 8.IBPluginDependency 8.IBViewBoundsToFrameTransform - 9.IBPluginDependency YES BrowseViewController UIResponder - com.apple.InterfaceBuilder.IBCocoaTouchPlugin {{329, 376}, {320, 480}} com.apple.InterfaceBuilder.IBCocoaTouchPlugin @@ -243,7 +209,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAACAgAAAAAACAAIAAgACAABAAEAAQABA P4AAAL+AAAAAAAAAw9aAAA - com.apple.InterfaceBuilder.IBCocoaTouchPlugin @@ -394,35 +359,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAACAgAAAAAACAAIAAgACAABAAEAAQABA UIKit.framework/Headers/UIResponder.h - - UIBarButtonItem - UIBarItem - - IBFrameworkSource - UIKit.framework/Headers/UIBarButtonItem.h - - - - UIBarItem - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIBarItem.h - - - - UINavigationBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UINavigationBar.h - - - - UINavigationItem - NSObject - - UIResponder NSObject diff --git a/Classes/PhotoViewController.m b/Classes/PhotoViewController.m index 35e58ca..6874df4 100644 --- a/Classes/PhotoViewController.m +++ b/Classes/PhotoViewController.m @@ -47,6 +47,54 @@ [customItem release]; [flex release]; [flex2 release]; + +// UIBarButtonItem *infoDarkButtonType = [[UIButton buttonWithType:UIButtonTypeInfoLight] retain]; +//// infoDarkButtonType = CGRectMake(0.0, 0.0, 25.0, 25.0); +//// infoDarkButtonType.backgroundColor = [UIColor clearColor]; +// [infoDarkButtonType addTarget:self action:@selector(infoButtonPressed:) forControlEvents:UIControlEventTouchUpInside]; +// UIBarButtonItem *infoButton = [[UIBarButtonItem alloc] initWithCustomView:infoDarkButtonType]; +// +// [self.navigationItem.leftBarButtonItem setTitle:@"back"]; + +// self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"back" +// style:UIBarButtonItemStyleBordered +// target:nil +// action:nil]; + +// self.navigationItem.rightBarButtonItem = [UIButton buttonWithType:UIButtonTypeInfoLight]; +// [infoDarkButtonType release]; +// [infoButton release]; +} + +//- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { +// [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; +// self.navigationItem.backBarButtonItem.title = @"back"; +//} + +- (void)updateChrome { + //[self updateTitle]; +// if (![self.previousViewController isKindOfClass: [TTThumbsViewController class]]) { +// if (_photoSource.numberOfPhotos > 1) { +// self.navigationItem.rightBarButtonItem = [[UIBarButtonItem +// alloc] +// initWithTitle:TTLocalizedString(@"See All", @"See all photo +// thumbnails") +// style:UIBarButtonItemStyleBordered target:self action:@selector +// (showThumbnails)]; +// } else { +// self.navigationItem.rightBarButtonItem = [UIButton buttonWithType:UIButtonTypeInfoLight]; +// } +// } else { +// self.navigationItem.rightBarButtonItem = [UIButton buttonWithType:UIButtonTypeInfoLight]; +// } + [super updateChrome]; + self.navigationItem.backBarButtonItem.title = @"back"; + //self.navigationItem.rightBarButtonItem = [UIButton buttonWithType:UIButtonTypeInfoLight]; +// UIBarButtonItem* playButton = [_toolbar itemWithTag:1]; +// playButton.enabled = _photoSource.numberOfPhotos > 1; +// _previousButton.enabled = _centerPhotoIndex > 0; +// _nextButton.enabled = _centerPhotoIndex < +// _photoSource.numberOfPhotos-1; } -(void)action:(id)sender{ diff --git a/Classes/PicCastAppDelegate.m b/Classes/PicCastAppDelegate.m index 3da5a07..854e3c7 100644 --- a/Classes/PicCastAppDelegate.m +++ b/Classes/PicCastAppDelegate.m @@ -9,6 +9,17 @@ #import "PicCastAppDelegate.h" #import +// monkey patches! what a racist term :'(, smh lol + +@implementation UIColor (PicCastColors) +-(void) orangeColor { + return [UIColor colorWithRed:1.0 green:143/255.0 blue:0.0 alpha:1.0]; +} + +-(void) yellowColor { + return [UIColor colorWithRed:209/255.0 green:231/255.0 blue:0.0 alpha:1.0]; +} +@end @implementation UINavigationBar (CustomImage) - (void)drawRect:(CGRect)rect { @@ -23,6 +34,37 @@ } //[super drawRect:rect]; } +- (void)drawLogo { + NSLog(@"logo"); + UIImageView *iv = [[[UIImageView alloc] initWithImage:[UIImage imageNamed: @"titleLogo.png"]] retain]; + [iv setFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)]; + [self addSubview:iv]; + [iv release]; +} +- (void)animateLoading { + UIImageView* animatedImageView = [[UIImageView alloc] initWithFrame:CGRectMake(6, 6, 32, 32)]; + + animatedImageView.animationImages = [NSArray arrayWithObjects: + [UIImage imageNamed:@"loading.1.png"], + [UIImage imageNamed:@"loading.2.png"], + [UIImage imageNamed:@"loading.3.png"], + [UIImage imageNamed:@"loading.4.png"], + nil]; + + animatedImageView.animationDuration = 0.25; + animatedImageView.animationRepeatCount = 0; + //add quartz core? + //animatedImageView.layer.opacity = 0.5; + + [self addSubview:animatedImageView]; + [animatedImageView startAnimating]; +} +- (void)stopLoadingAnimation { + for (id obj in [self subviews]) { + if ([obj isKindOfClass:[UIImageView class]] && [(UIImageView *)obj animationDuration] == 0.25) + [obj removeFromSuperview]; + } +} @end @implementation PicCastAppDelegate diff --git a/Classes/SearchViewController.m b/Classes/SearchViewController.m index 8272dd9..e4718be 100644 --- a/Classes/SearchViewController.m +++ b/Classes/SearchViewController.m @@ -17,6 +17,14 @@ - (void)viewDidLoad { [super viewDidLoad]; + [self.navigationController.navigationBar drawLogo]; + + UIView *backgroundView = [[UIView alloc] initWithFrame:self.view.frame]; + backgroundView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"backgroundGradient.png"]]; + + self.tableView.backgroundView = backgroundView; + self.tableView.backgroundColor = [UIColor clearColor]; + [self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleSingleLine]; [self.tableView setSeparatorColor:[UIColor colorWithRed:0.9 green:0.9 blue:0.9 alpha:1.0]]; @@ -132,16 +140,49 @@ #pragma mark - #pragma mark uitableviewcontroller protocol +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section +{ + // create the parent view that will hold header Label + UIView* customView = [[UIView alloc] initWithFrame:CGRectMake(10.0, 0.0, 300.0, 44.0)]; + + // create the button object + UILabel * headerLabel = [[UILabel alloc] initWithFrame:CGRectZero]; + headerLabel.backgroundColor = [UIColor clearColor]; + headerLabel.opaque = NO; + headerLabel.textColor = [UIColor orangeColor]; + headerLabel.highlightedTextColor = [UIColor whiteColor]; + headerLabel.font = [UIFont boldSystemFontOfSize:20]; + headerLabel.frame = CGRectMake(10.0, 0.0, 300.0, 44.0); + + // If you want to align the header text as centered + // headerLabel.frame = CGRectMake(150.0, 0.0, 300.0, 44.0); + + headerLabel.text = @"tamper proof cap"; // i.e. array element + [customView addSubview:headerLabel]; + + return customView; +} + +- (CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section +{ + return 44.0; +} + - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - return 10; + return 3; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return 5; + return 3; } - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { - return @"tamper proof cap"; + if (section == 0) + return @"Feeds"; + else if (section == 1) + return @"Sets"; + else + return @"Photos"; } //- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath diff --git a/Classes/SourcesEditViewController.xib b/Classes/SourcesEditViewController.xib index 774a35b..ed531bd 100644 --- a/Classes/SourcesEditViewController.xib +++ b/Classes/SourcesEditViewController.xib @@ -12,7 +12,7 @@ YES - + YES @@ -107,7 +107,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAACAgAAAAAACAAIAAgACAABAAEAAQABA YES - Edit PicCast Sources + Edit Subscriptions Done IBCocoaTouchFramework @@ -288,14 +288,35 @@ AAMAAAABAAEAAAFTAAMAAAAEAAACAgAAAAAACAAIAAgACAABAAEAAQABA SourcesEditViewController UIViewController - done: - id + YES + + YES + done: + switchedOnOff: + + + YES + id + id + - done: - - done: - id + YES + + YES + done: + switchedOnOff: + + + YES + + done: + id + + + switchedOnOff: + id + diff --git a/Classes/TopicTableViewCell.m b/Classes/TopicTableViewCell.m index c2753b6..03d202d 100644 --- a/Classes/TopicTableViewCell.m +++ b/Classes/TopicTableViewCell.m @@ -21,9 +21,28 @@ } // titleLabel.lineBreakMode = UILineBreakModeWordWrap; // titleLabel.numberOfLines = 0; +// UIView *backgroundView = [[UIView alloc] initWithFrame:self.frame]; +// backgroundView.backgroundColor = [UIColor whiteColor]; +// self.backgroundView = backgroundView; +// [backgroundView release]; + + //self.contentView.backgroundColor = [UIColor whiteColor]; + //NSLog(@"where"); return self; } +//- (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier { +// [super initWithFrame:frame reuseIdentifier:reuseIdentifier]; +// NSLog(@"here"); +//} +//- (void)init { +// [super init]; +// NSLog(@"there"); +// UIView *myBackView = [[UIView alloc] initWithFrame:self.frame]; +// myBackView.backgroundColor = [UIColor whiteColor]; +// self.backgroundView = myBackView; +//} + - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [gradient removeFromSuperview]; [super setSelected:selected animated:animated]; diff --git a/Classes/TopicsViewController.m b/Classes/TopicsViewController.m index d7ca089..9505272 100644 --- a/Classes/TopicsViewController.m +++ b/Classes/TopicsViewController.m @@ -30,10 +30,21 @@ - (void)viewDidLoad { [super viewDidLoad]; NSLog(@"viewDidLoad"); + + [self.navigationController.navigationBar drawLogo]; + self.tableView.rowHeight = 100; [self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleSingleLine]; [self.tableView setSeparatorColor:[UIColor colorWithRed:0.9 green:0.9 blue:0.9 alpha:1.0]]; + UIView *backgroundView = [[UIView alloc] initWithFrame:self.view.frame]; + backgroundView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"backgroundGradient.png"]]; + + self.tableView.backgroundView = backgroundView; + self.tableView.backgroundColor = [UIColor clearColor]; + + [backgroundView release]; + objMan = [[HJObjManager alloc] initWithLoadingBufferSize:6 memCacheSize:20]; _today = [[Topic dateToString:[NSDate new]] retain]; @@ -203,6 +214,8 @@ } [result close]; [db close]; + + [self.navigationController.navigationBar animateLoading]; } #pragma mark - @@ -218,6 +231,7 @@ } - (void) connection:(NSURLConnection *)connection finishedWithData:(NSData *)data andPayload:(id)payload { + [self.navigationController.navigationBar stopLoadingAnimation]; [self addTopicsFromJson:data forSource:(Source *)payload]; } @@ -369,6 +383,10 @@ [micon clear]; [mi clear]; } + + UIView *myBackView = [[UIView alloc] initWithFrame:cell.frame]; + myBackView.backgroundColor = [UIColor whiteColor]; + cell.backgroundView = myBackView; Topic *topic = [[tableDictionary objectForIndex:[indexPath section]] objectAtIndex:[indexPath row]]; //cell.useDarkBackground = (indexPath.row % 2 == 0); -- cgit v1.2.3