星空网 > 软件开发 > 操作系统

【代码笔记】翻页效果的实现

一,效果图。

【代码笔记】翻页效果的实现images/loading.gif' data-original="http://images2015.cnblogs.com/blog/337518/201510/337518-20151015145305179-300459166.jpg" width="217" height="400" />

 

 

【代码笔记】翻页效果的实现

二,工程图。

【代码笔记】翻页效果的实现

三,代码。

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.}
【代码笔记】翻页效果的实现

 

 


 

原标题:【代码笔记】翻页效果的实现

关键词:

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

SP API:https://www.goluckyvip.com/tag/25617.html
Spar Abo:https://www.goluckyvip.com/tag/25618.html
Sparblog:https://www.goluckyvip.com/tag/25619.html
跨境支付现状:https://www.goluckyvip.com/tag/2562.html
Sparbote:https://www.goluckyvip.com/tag/25620.html
Spark:https://www.goluckyvip.com/tag/25621.html
商机!速卖通推出小B采销节,挖掘机、莫桑钻、电动车近期在海外走俏!:https://www.xlkjsw.com/news/93297.html
Zalando对欧盟在线平台监管费提出质疑:https://www.kjdsnews.com/a/1842241.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流