【代码笔记】翻页效果的实现
2016-02-22 09:40
459 查看
一,效果图。
二,工程图。
三,代码。
RootViewController.h
RootViewController.m
FirstViewController.h
FirstViewController.m
二,工程图。
三,代码。
RootViewController.h
#import <UIKit/UIKit.h> @interface RootViewController : UIViewController @end
RootViewController.m
#import "RootViewController.h" #import "FirstViewController.h" @interface RootViewController () @end @implementation RootViewController - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } return self; } - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. //设置背景色 self.view.backgroundColor=[UIColor redColor]; self.title=@"root"; } -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { //点击root,也就是红色的任何处,页面会像翻书一样翻转。翻转到first,也就是蓝色的界面。当点击顶部root页面部分的时候,页面会重新翻到root,也就是红色的界面。 FirstViewController *firstView=[[FirstViewController alloc]init]; UINavigationController *nav=[[UINavigationController alloc] initWithRootViewController:firstView]; nav.modalTransitionStyle=UIModalTransitionStylePartialCurl; [self.navigationController presentViewController:nav animated:YES completion:nil]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. }
FirstViewController.h
#import <UIKit/UIKit.h> @interface FirstViewController : UIViewController @end
FirstViewController.m
#import "FirstViewController.h" @interface FirstViewController () @end @implementation FirstViewController - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } return self; } - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. //设置背景色 self.view.backgroundColor=[UIColor blueColor]; self.title=@"first"; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. }
相关文章推荐
- 【代码笔记】翻页效果的实现
- Java 倒序输出
- Maven实战 5 -- Maven与Eclipse整合
- python进制转换(读取纯二进制文件内容)
- php配置文件php.ini中文详解
- python迭代器
- SpringMVC整合JSON、XML视图
- 字节流对文件的操作更多适用于文件复制和传送,而字符流则注重于文件的读取分析操作
- c/c++ 面试积累
- python用paramiko模块上传本地目录到远程目录
- VBA outlook实战#01--自动回复邮件
- socket编程
- php-eclipse-xdebug-配置
- 深入分析JavaWeb 42 -- JavaMail创建邮件和发送邮件
- PHP线程安全和非线程安全的区别
- 深入分析JavaWeb 41 -- 邮件的发送与接收原理
- C#中XML与对象之间的序列化、反序列化
- 图片处理类库PHPThumb
- 0代码隐藏GroupedTableView上边多余的间隔
- 深入分析JavaWeb 40 -- 文件上传和下载