网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

PPRevealSideViewController第三库的简单例子

PPRevealSideViewController第三库的简单例子

创新互联建站专注于企业全网营销推广、网站重做改版、望都网站定制设计、自适应品牌网站建设、H5响应式网站商城网站建设、集团公司官网建设、外贸网站制作、高端网站制作、响应式网页设计等建站业务,价格优惠性价比高,为望都等各大城市提供网站开发制作服务。

代码下载:


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];
}


当前标题:PPRevealSideViewController第三库的简单例子
文章URL:http://bjjierui.cn/article/goodpg.html

其他资讯