本文主要是介绍[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
示意图:
这篇关于[iOS]JASidePanels(侧滑栏)的使用的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!