资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

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

PPRevealSideViewController第三库的简单例子

专注于为中小企业提供成都做网站、网站设计、外贸营销网站建设服务,电脑端+手机端+微信端的三站合一,更高效的管理,为中小企业双牌免费做网站提供优质的服务。我们立足成都,凝聚了一批互联网行业人才,有力地推动了1000+企业的稳健成长,帮助中小企业通过网站建设实现规模扩充和转变。

代码下载:

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第三库的简单例子-创新互联
链接URL:http://cdkjz.cn/article/spije.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220