以前,写了一篇文章:UIView显示边栏的方法,这篇文章实现了相同的功能,本文只列出部分核心代码,具体的请参考附件。
AppDelegate.h
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) PPRevealSideViewController *revealSideViewController;
@end
AppDelegate.m
#import "AppDelegate.h"
#import "RootViewController.h"
@implementation AppDelegate
@synthesize window = _window;
@synthesize revealSideViewController = _revealSideViewController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
RootViewController *main = [[RootViewController alloc] initWithStyle:UITableViewStyleGrouped];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:main];
self.revealSideViewController = [[PPRevealSideViewController alloc] initWithRootViewController:nav];
[self.revealSideViewController setDirectionsToShowBounce:PPRevealSideDirectionNone];
self.window.rootViewController = self.revealSideViewController;
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
return YES;
}
@end
主视图中的核心代码:
- (void) showLeft:(id)sender {
[self.revealSideViewController pushOldViewControllerOnDirection:PPRevealSideDirectionLeft animated:YES];
}
- (void) viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
LeftViewController *left = [[LeftViewController alloc] initWithStyle:UITableViewStylePlain];
[self.revealSideViewController preloadViewController:left forSide:PPRevealSideDirectionLeft];
}
示例图:
分享到:
相关推荐
使用拓展与runtime,为UIView添加手势事件
UIView 动画 UIView动画
ios中关于uiview
UIView+Extension 对view的一个扩展
UIView AutoLayout ,UIView AutoLayout 是 UIView 的分类,实现了自动布局限制的简单接口。 T...
详细讲解UIView的生命循环周期,对开发者有更好的启发作用,深层次了解程序运行的流程。
UIView-Positioning, 在UIView对象中,基于简单属性的框架属性设置 uiview定位收费 UIView Positioning 是一个快速扩展,它提供简单的shorthand 方法,以方便的方式定义任何UIView对象的框架属性( 宽度,高度,x,y ...
1、将UIView 保存为图片,按照给定的scale 2、stackoverflow参照 3、保存的图片为依据scale,亲测
UIView+复制 用法 要运行示例项目, pod install克隆 repo,然后从 Example 目录运行pod install 。 #import <UIView> //If you need drawRect: drawing UIView *copiedView = [originalView pm_copy]; //if you ...
+ (UIView *_Nullable)az_gradientViewWithColors:(NSArray*> *_Nullable)colors locations:(NSArray*> *_Nullable)locations startPoint:(CGPoint)startPoint endPoint:(CGPoint)endPoint; - (void)az_...
为UIView添加圆角扩展
已封装好的实现渐变的UIView,只需传入渐变开始值和结束值就可直接使用。有四种渐变方向可选
简单的把UIView转化为UIImage,大家可以看下。
UIView 震动动画效果 AFViewShaker ,AFViewShaker 是一个简单的工具用来执行 。 使用方法: AFViewShaker *...
iOS中UIView的翻页动画demo 有几个是私有的api,小心使用。
通过协议扩展高斯模糊任意 UIView.zip,对任何具有swift协议扩展的uiview应用高斯模糊
iPhone开发学习笔记005——使用XIB自定义一个UIView,然后将这个view添加到controller的view。
本文通过实例代码给大家详细介绍了iOS UIView常见属性方法,非常不错,需要的朋友参考下吧
uiview+frame,方便UI布局,码农工具,第一次上传,测下好用不
自定义NSLayoutConstraint约束库