diff options
author | Jay Freeman (saurik) <saurik@saurik.com> | 2008-12-04 07:17:49 +0000 |
---|---|---|
committer | Jay Freeman (saurik) <saurik@saurik.com> | 2010-09-30 07:09:00 +0000 |
commit | 22f8bed9669aee2b33cbc4da49eea3106e91c338 (patch) | |
tree | 6fee9ee08b04bf3d7a3f0997a97d49e8d861f4e7 /UICaboodle/RVBook.mm | |
parent | 03c0f7a9657ad201acfa37b0f94bc080014a4516 (diff) |
Reorganized code and mostly finished ratings indicator.
Diffstat (limited to 'UICaboodle/RVBook.mm')
-rw-r--r-- | UICaboodle/RVBook.mm | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/UICaboodle/RVBook.mm b/UICaboodle/RVBook.mm index 708e66f..a6f5318 100644 --- a/UICaboodle/RVBook.mm +++ b/UICaboodle/RVBook.mm @@ -18,6 +18,47 @@ #import "RVPage.h" +@interface NSObject (UICaboodleRVBook) +- (float) widthForButtonContents:(float)width; +@end + +@implementation NSObject (UICaboodleRVBook) + +- (float) widthForButtonContents:(float)width { + return width; +} + +@end + +@interface UIImage (UICaboodleRVBook) +- (float) widthForButtonContents:(float)width; +@end + +@implementation UIImage (UICaboodleRVBook) + +- (float) widthForButtonContents:(float)width { + return [self size].width + 8; +} + +@end + +@interface RVNavigationBar : UINavigationBar { +} + +- (id) createButtonWithContents:(id)contents width:(float)width barStyle:(int)barStyle buttonStyle:(int)style isRight:(BOOL)right; +@end + +@implementation RVNavigationBar + +- (id) createButtonWithContents:(id)contents width:(float)width barStyle:(int)barStyle buttonStyle:(int)style isRight:(BOOL)right { + float adjust = [contents widthForButtonContents:width]; + NSLog(@"cc:%@:%g:%g", contents, width, adjust); + width = adjust; + return [super createButtonWithContents:contents width:width barStyle:barStyle buttonStyle:style isRight:right]; +} + +@end + @implementation RVBook - (void) dealloc { @@ -59,7 +100,7 @@ CGSize navsize = [UINavigationBar defaultSize]; CGRect navrect = {{0, 0}, navsize}; - navbar_ = [[UINavigationBar alloc] initWithFrame:navrect]; + navbar_ = [[RVNavigationBar alloc] initWithFrame:navrect]; [self addSubview:navbar_]; [navbar_ setBarStyle:0]; |