Skip to content

Commit

Permalink
Add a cardNavigationBarClass configuration option
Browse files Browse the repository at this point in the history
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 b514a79
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Classes/KLNoteViewController.h
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion Classes/KLNoteViewController.m
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b514a79

Please sign in to comment.