PPRevealSideViewController第三库的简单例子-创新互联
PPRevealSideViewController第三库的简单例子

代码下载:
http://pan.baidu.com/share/link?shareid=3833108176&uk=3189484501
这个第三方库是能够实现左右滑动视图控制器效果的第三方库,第三库在代码例子中就有的
首先,我们需要再创建一个视图控制器,让它直接继承自UITableViewController
我们不需要额外添加代码。
AppDelegate.h代码实现如下:
#import#import "PPRevealSideViewController.h" @class ViewController; @interface AppDelegate : UIResponder @property (strong, nonatomic) UIWindow *window; @property (strong, nonatomic) ViewController *viewController; @property (strong, nonatomic) PPRevealSideViewController* revealSideViewController; @property (strong, nonatomic) UINavigationController* nav; @end
.m文件实现如下:
我们要在
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions方法添加如下代码:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];
//创建一个导航
self.nav = [[UINavigationController alloc] initWithRootViewController:self.viewController];
//初始化一个可以左右划第三库的对象
self.revealSideViewController = [[PPRevealSideViewController alloc] initWithRootViewController:self.nav];
self.revealSideViewController.panInteractionsWhenClosed = PPRevealSideInteractionContentView|PPRevealSideInteractionNavigationBar;
self.window.rootViewController = self.revealSideViewController;
// PP_RELEASE(self.viewController);
// PP_RELEASE(self.nav);
[self.window makeKeyAndVisible];
return YES;
}ViewController.h代码实现如下:
#import#import "TableViewControllerABC.h" #import "PPRevealSideViewController.h" @interface ViewController : UIViewController @property (strong , nonatomic) TableViewControllerABC* tB; @end
ViewController.m代码如下:
-(void)viewWillAppear:(BOOL)animated
{
self.tB = [[TableViewControllerABC alloc] initWithStyle:UITableViewStylePlain];
//设置左划显示的视图控制器
[self.revealSideViewController preloadViewController:self.tB forSide:PPRevealSideDirectionLeft];
[super viewWillAppear:animated];
}另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
当前标题:PPRevealSideViewController第三库的简单例子-创新互联
本文地址:http://www.jxjierui.cn/article/spije.html


咨询
建站咨询
