From 64e9e2e8d01ec34e5d7a2c1cb11d3780408403c4 Mon Sep 17 00:00:00 2001 From: matt handler Date: Thu, 21 Apr 2011 19:19:57 -0400 Subject: add titlebar image, loading image, loading fade, sources edit page has onoff switch but needs it to work better, drawRect override for navigationbar --- Classes/PicCastAppDelegate.m | 20 ++++++++++++++++- Classes/SourcesEditViewController.m | 24 +++++++++++++++++--- Classes/SourcesEditViewController.xib | 42 +++++++++++++++++------------------ Classes/TopicTableViewCell.m | 2 +- Classes/TopicsViewController.m | 17 ++++++++++++++ 5 files changed, 79 insertions(+), 26 deletions(-) (limited to 'Classes') diff --git a/Classes/PicCastAppDelegate.m b/Classes/PicCastAppDelegate.m index 3091f4a..f028035 100644 --- a/Classes/PicCastAppDelegate.m +++ b/Classes/PicCastAppDelegate.m @@ -27,13 +27,31 @@ // Add the tab bar controller's view to the window and display. [self.window addSubview:tabBarController.view]; [self.window makeKeyAndVisible]; + + [self doDefaultPngFade]; //navigationController = [[UINavigationController alloc] initWithRootViewController:(UIViewController *)tabBarController]; // this was put in because i errored out on some gif files that i guess were really large? [[TTURLRequestQueue mainQueue] setMaxContentLength:0]; - + return YES; } +- (void)doDefaultPngFade { + // add the new image to fade out + UIImageView * defaultFadeImage; + defaultFadeImage = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Default.png"]] autorelease]; + [self.tabBarController.view addSubview:defaultFadeImage]; + + + // and start the default fadeout + [UIView beginAnimations:@"InitialFadeIn" context:nil]; + [UIView setAnimationDelegate:defaultFadeImage]; + [UIView setAnimationDidStopSelector:@selector( removeFromSuperview )]; + [UIView setAnimationDelay:0.0]; // stay on this long extra + [UIView setAnimationDuration:1.00]; // transition speed + [defaultFadeImage setAlpha:0.0]; + [UIView commitAnimations]; +} - (void)applicationWillResignActive:(UIApplication *)application { /* diff --git a/Classes/SourcesEditViewController.m b/Classes/SourcesEditViewController.m index 7c04808..d0ca382 100644 --- a/Classes/SourcesEditViewController.m +++ b/Classes/SourcesEditViewController.m @@ -7,6 +7,7 @@ // #import "SourcesEditViewController.h" +#import "SourcesEditViewCell.h" @implementation SourcesEditViewController @@ -19,6 +20,8 @@ - (void)viewDidLoad { [super viewDidLoad]; + + self.tableView.rowHeight = 100; // Uncomment the following line to display an Edit button in the navigation bar for this view controller. // self.navigationItem.rightBarButtonItem = self.editButtonItem; @@ -84,11 +87,26 @@ // Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - static NSString *CellIdentifier = @"Cell"; + static NSString *CellIdentifier = @"SourcesEditCell"; - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; + SourcesEditViewCell *cell = (SourcesEditViewCell *)[self.tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; + NSArray *tmpCell = [[NSBundle mainBundle] loadNibNamed:@"TopicTableViewCell" owner:self options:nil]; + + for (id currentObj in tmpCell) { + if ([currentObj isKindOfClass:[TopicTableViewCell class]]) { + cell = (SourcesEditViewCell *)currentObj; + [cell setSelectionStyle:UITableViewCellSelectionStyleNone]; + + UISwitch *mySwitch = [[[UISwitch alloc] initWithFrame:CGRectZero] autorelease]; + [cell addSubview:mySwitch]; + cell.accessoryView = mySwitch; + + //cell.accessoryView = cell.switcher; + break; + } + } + //cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } // Configure the cell... diff --git a/Classes/SourcesEditViewController.xib b/Classes/SourcesEditViewController.xib index 5c21a8d..47dd98b 100644 --- a/Classes/SourcesEditViewController.xib +++ b/Classes/SourcesEditViewController.xib @@ -12,7 +12,7 @@ YES - + YES @@ -47,7 +47,7 @@ 274 {{0, 44}, {320, 416}} - + 3 MQA @@ -64,7 +64,7 @@ 22 22 - + 290 {320, 44} @@ -76,14 +76,14 @@ YES - - - Title - + + + Edit PicCast Sources + Done IBCocoaTouchFramework - 1 - + 2 + IBCocoaTouchFramework @@ -92,7 +92,7 @@ {320, 460} - + IBCocoaTouchFramework @@ -134,7 +134,7 @@ done: - + 20 @@ -165,7 +165,7 @@ YES - + @@ -177,26 +177,26 @@ 11 - + YES - + 14 - + YES - + - + 15 - - + + @@ -430,7 +430,7 @@ UINavigationBar UIView - + IBFrameworkSource UIKit.framework/Headers/UINavigationBar.h @@ -438,7 +438,7 @@ UINavigationItem NSObject - + UIResponder diff --git a/Classes/TopicTableViewCell.m b/Classes/TopicTableViewCell.m index a933c7d..4893ff4 100644 --- a/Classes/TopicTableViewCell.m +++ b/Classes/TopicTableViewCell.m @@ -11,7 +11,7 @@ @implementation TopicTableViewCell -@synthesize useDarkBackground, title, iconUrl, picCount, gradient; // titleLabel, icon +@synthesize useDarkBackground, title, iconUrl, picCount, picCountLabel, gradient; // titleLabel, icon - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { diff --git a/Classes/TopicsViewController.m b/Classes/TopicsViewController.m index 4c855d6..9969962 100644 --- a/Classes/TopicsViewController.m +++ b/Classes/TopicsViewController.m @@ -18,6 +18,18 @@ #import "SourcesEditViewController.h" +@implementation UINavigationBar (CustomImage) +- (void)drawRect:(CGRect)rect { +// NSLog(@"titlebar"); +// if (self.barStyle == UIBarStyleDefault) { + UIImage *image = [UIImage imageNamed: @"titleBarBackground.png"]; + [image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)]; +// } +// else + //[super drawRect:rect]; +} +@end + @implementation TopicsViewController @synthesize topics, parser; @@ -46,6 +58,11 @@ fileCache.fileCountLimit = 100; fileCache.fileAgeLimit = 60*60*24*7; //1 week [fileCache trimCacheUsingBackgroundThread]; + +// UIWindow *window = [appDelegate window]; +// UIImageView *bgView = [[UIImageView alloc] init]; +// [bgView setImage:[UIImage imageNamed: @"Default.png"]]; +// [window addSubView:bgView]; [self startParsing]; } -- cgit v1.2.3