Permalink
Browse files

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.
  • Loading branch information...
dulacp committed Mar 15, 2013
1 parent fe2e9ed commit b514a79d6f6fef0b7d07dbf0b59ce0ca14694750
Showing with 8 additions and 1 deletion.
  1. +3 −0 Classes/KLNoteViewController.h
  2. +5 −1 Classes/KLNoteViewController.m
@@ -62,6 +62,9 @@ typedef UInt32 KLControllerCardPanGestureScope;
@property (nonatomic, assign) id<KLNoteViewControllerDataSource> dataSource;
@property (nonatomic, assign) id<KLNoteViewControllerDelegate> 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
@@ -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

0 comments on commit b514a79

Please sign in to comment.