From b514a79d6f6fef0b7d07dbf0b59ce0ca14694750 Mon Sep 17 00:00:00 2001 From: Pierre Dulac Date: Sat, 16 Mar 2013 00:44:52 +0100 Subject: [PATCH] Add a `cardNavigationBarClass` configuration option Apple introduce in iOS5 a new `UINavigationController` method `initWithNavigationBarClass:toolbarClass:` to properly customize the navigation bar used. I think it's important that we can control that aspect. --- Classes/KLNoteViewController.h | 3 +++ Classes/KLNoteViewController.m | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Classes/KLNoteViewController.h b/Classes/KLNoteViewController.h index b7ad0d2..1501a0d 100644 --- a/Classes/KLNoteViewController.h +++ b/Classes/KLNoteViewController.h @@ -62,6 +62,9 @@ typedef UInt32 KLControllerCardPanGestureScope; @property (nonatomic, assign) id dataSource; @property (nonatomic, assign) id delegate; +//Navigation bar properties +@property (nonatomic, strong) Class cardNavigationBarClass; //Use a custom class for the card navigation bar + //Layout properties @property (nonatomic) CGFloat cardMinimizedScalingFactor; //Amount to shrink each card from the previous one @property (nonatomic) CGFloat cardMaximizedScalingFactor; //Maximum a card can be scaled to diff --git a/Classes/KLNoteViewController.m b/Classes/KLNoteViewController.m index d3d7497..ed58f7d 100644 --- a/Classes/KLNoteViewController.m +++ b/Classes/KLNoteViewController.m @@ -71,6 +71,8 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil } - (void)configureDefaultSettings { + self.cardNavigationBarClass = [UINavigationBar class]; + self.cardMinimizedScalingFactor = kDefaultMinimizedScalingFactor; self.cardMaximizedScalingFactor = kDefaultMaximizedScalingFactor; self.cardNavigationBarOverlap = kDefaultNavigationBarOverlap; @@ -143,7 +145,9 @@ - (void) reloadData { for (NSInteger count = 0; count < totalCards; count++) { UIViewController* viewController = [self noteView:self viewControllerForRowAtIndexPath:[NSIndexPath indexPathForRow:count inSection:0]]; - UINavigationController* navigationController = [[UINavigationController alloc] initWithRootViewController:viewController]; + UINavigationController* navigationController = [[UINavigationController alloc] initWithNavigationBarClass:self.cardNavigationBarClass + toolbarClass:[UIToolbar class]]; + [navigationController pushViewController:viewController animated:NO]; KLControllerCard* noteContainer = [[KLControllerCard alloc] initWithNoteViewController: self navigationController: navigationController