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第三库的简单例子
本文网址:http://csdahua.cn/article/goodpg.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流