KLNoteViewController 笔记本导航的样式

http://www.cocoacontrols.com/controls/klnoteviewcontroller


KLNoteViewController

A control that organizes multiple navigation controllers in a stack inspired by Evernote 5.0 app

Note: KLNoteViewController is intended for use with portrait orientation on iPhone/iPad/iPod Touch.

Check out the Demo Excuse the graphics glitches and lag due to my slow computer.

Installation

Drag the included KLNoteViewController.h, KLNoteViewController.m files into your project. Then, include the following frameworks under Link Binary With Libraries:

  • QuartzCore.framework

Usage

Import the header file and declare your controller to subclass KLNoteViewController #import "KLNoteViewController.h"

@interface KLRootViewController : KLNoteViewController

OR, Import the header file and declare your controller to conform to KLNoteViewControllerDataSource and KLNoteViewControllerDelegate

#import "KLNoteViewController.h"

@interface KLRootViewController : UIViewController <KLNoteViewControllerDataSource, KLNoteViewControllerDelegate>
@property(nonatomic, strong) KLNoteViewController* noteViewController;

Implement the required methods of the data source

- (NSInteger)numberOfControllerCardsInNoteView:(KLNoteViewController*) noteView;
- (UIViewController *)noteView:(KLNoteViewController*)noteView viewControllerForRowAtIndexPath:(NSIndexPath *)indexPath;

Example - Should be changed to suit your needs

- (NSInteger)numberOfControllerCardsInNoteView:(KLNoteViewController*) noteView {
    return  [self.viewControllers count];
}
- (UIViewController *)noteView:(KLNoteViewController*)noteView viewControllerForRowAtIndexPath:(NSIndexPath *)indexPath {
    //Get the relevant data for the navigation controller
    NSDictionary* navDict = [self.navigationControllers objectAtIndex: indexPath.row];

    //Initialize a blank uiviewcontroller for display purposes
    UIStoryboard *st = [UIStoryboard storyboardWithName:[[NSBundle mainBundle].infoDictionary objectForKey:@"UIMainStoryboardFile"] bundle:[NSBundle mainBundle]];

    KLCustomViewController* viewController = [st instantiateViewControllerWithIdentifier:@"RootViewController"];
    [viewController setInfo: navDict];

    //Return the custom view controller
    return viewController;
}

Implement the optional delegate method to be notified when a card changes state

//Called on any time a state change has occured - even if a state has changed to itself - (i.e. from KLControllerCardStateDefault to KLControllerCardStateDefault)
-(void) noteViewController: (KLNoteViewController*) noteViewController didUpdateControllerCard:(KLControllerCard*)controllerCard toDisplayState:(KLControllerCardState) toState fromDisplayState:(KLControllerCardState) fromState;

Config

The visual appearance can be tweaked by changing the constants in KLNoteViewController.m:

//Layout properties
#define kDefaultMinimizedScalingFactor 0.98     //Amount to shrink each card from the previous one
#define kDefaultMaximizedScalingFactor 1.00     //Maximum a card can be scaled to
#define kDefaultNavigationBarOverlap 0.90       //Defines vertical overlap of each navigation toolbar. Slight hack that prevents rounding errors from showing the whitespace between navigation toolbars. Can be customized if require more/less packing of navigation toolbars

//Animation properties
#define kDefaultAnimationDuration 0.3           //Amount of time for the animations to occur
#define kDefaultReloadHideAnimationDuration 0.4
#define kDefaultReloadShowAnimationDuration 0.6

//Position for the stack of navigation controllers to originate at
#define kDefaultVerticalOrigin 100              //Vertical origin of the controller card stack. Making this value larger/smaller will make the card shift down/up.

//Corner radius properties
#define kDefaultCornerRadius 5.0

//Shadow Properties - Note : Disabling shadows greatly improves performance and fluidity of animations
#define kDefaultShadowEnabled YES
#define kDefaultShadowColor [UIColor blackColor]
#define kDefaultShadowOffset CGSizeMake(0, -5)
#define kDefaultShadowRadius kDefaultCornerRadius
#define kDefaultShadowOpacity 0.60

//Gesture properties
#define kDefaultMinimumPressDuration 0.2

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值