您的位置:首页 > 移动开发 > IOS开发

IOS之左右滑动效果的实现——利用JASidePanels

2014-01-03 15:25 423 查看
IOS之滑动效果的实现——JASidePanels

之前我已经介绍过了两个可以比较好的实现Sliding功能的第三方类:IOS之左右滑动效果的实现——利用SWRevealViewController
IOS之左右滑动效果的实现——利用PPRevealViewController
然后这两个类库有一个缺点当页面侧滑出菜单栏时用户仍然可以点击或者滑动主页面上的按钮或者ScrollView,这就会影响用户的体验。今天介绍的这个第三方类库很好的解决了这个问题,今天我们就来学习一下如何使用这个类库来实现我们的左右滑动效果。
首先,我们要从Github上取得代码:https://github.com/gotosleep/JASidePanels
然后,我们将取得的代码加入工程中,并开始使用
#import "JAAppDelegate.h"

#import "JASidePanelController.h"
#import "JACenterViewController.h"
#import "JALeftViewController.h"
#import "JARightViewController.h"

@implementation JAAppDelegate

@synthesize window = _window;
@synthesize viewController = _viewController;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

self.viewController = [[JASidePanelController alloc] init];
self.viewController.leftPanel = [[JALeftViewController alloc] init];
self.viewController.centerPanel = [[UINavigationController alloc] initWithRootViewController:[[JACenterViewController alloc] init]];
self.viewController.rightPanel = [[JARightViewController alloc] init];

self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}

@end


这样,我们就完成了左右滑动的效果,而且比较好的是这个类库不需要我们再添加Menu按钮。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ios