[iOS]JASidePanels(侧滑栏)的使用

GitHub地址:https://github.com/gotosleep/JASidePanels

Demo地址:http://download.csdn.net/detail/u012881779/8833961
JASidePanels是一个很实用的第三方的侧滑工具


#import "AppDelegate.h"
#import "HomeViewController.h"
#import "LeftPanelViewController.h"
#import "RightPanelViewController.h"
#import "JASidePanelController.h"

@interface AppDelegate ()
@property (strong, nonatomic) UINavigationController *nav;
@end

@implementation AppDelegate
@synthesize nav = _nav;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    self.window.backgroundColor = [UIColor whiteColor];
    
    HomeViewController* home = [[HomeViewController alloc] initWithNibName:@"HomeViewController" bundle:nil];
    LeftPanelViewController* left = [[LeftPanelViewController alloc] initWithNibName:@"LeftPanelViewController" bundle:nil];
    RightPanelViewController* right = [[RightPanelViewController alloc] initWithNibName:@"RightPanelViewController" bundle:nil];
    
    //侧滑栏
    JASidePanelController *panelVC = [[JASidePanelController alloc] init];
    panelVC.leftPanel = left;
    panelVC.rightPanel = right;
    panelVC.centerPanel = home;
    
    //导航
    _nav = [[UINavigationController alloc] initWithRootViewController:panelVC];
    [_nav setNavigationBarHidden:YES];
    self.window.rootViewController = _nav;
    [self.window makeKeyAndVisible];
    return YES;
}

首页:


#import "HomeViewController.h"
#import "JASidePanelController.h"

@interface HomeViewController ()
@end

@implementation HomeViewController
- (IBAction)leftPanelAction:(id)sender {
    [[JASidePanelController share] toggleLeftPanel:nil];
}

- (IBAction)rightPanelAction:(id)sender {
    [[JASidePanelController share] toggleRightPanel:nil];
}

@end

JASidePanel设置侧栏参数:


#import <QuartzCore/QuartzCore.h>
#import "JASidePanelController.h"
@interface JASidePanelController() 
@end

@implementation JASidePanelController
- (void)_baseInit {
    [[UIApplication sharedApplication] setStatusBarHidden:NO];
    self.style = JASidePanelSingleActive;
    //左侧栏目比例
    self.leftGapPercentage =  0.52f;
    //右侧栏目比例
    self.rightGapPercentage = 0.8f;
    self.minimumMovePercentage = 0.15f;
    self.maximumAnimationDuration = 0.2f;
    self.bounceDuration = 0.1f;
    self.bouncePercentage = 0.075f;
    self.panningLimitedToTopViewController = YES;
    self.recognizesPanGesture = YES;
    self.allowLeftOverpan = YES;
    self.allowRightOverpan = YES;
    self.bounceOnSidePanelOpen = YES;
    self.shouldDelegateAutorotateToVisiblePanel = YES;
}
@end

示意图:

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值