iOS开发之抽屉效果实现
作者:网络转载 发布时间:[ 2014/11/13 14:51:58 ] 推荐标签:iOS 软件开发 移动开发 抽屉
3.在主界面使用PPRevealSideViewController来推出导航页
1 - (IBAction)tapItem:(id)sender {
2
3 UIStoryboard *storybaord = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
4 UITableViewController *table = [storybaord instantiateViewControllerWithIdentifier:@"CustomViewViewController"];
5 [self.revealSideViewController pushViewController:table onDirection:PPRevealSideDirectionLeft animated:YES];
6 }
4.在导航页点击不同的按钮使用PPRevealSideViewController跳转到不同的controller
1 - (IBAction)tap1:(id)sender {
2 UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
3 UIViewController *one = [storyboard instantiateViewControllerWithIdentifier:@"one"];
4 [self.revealSideViewController popViewControllerWithNewCenterController:one animated:YES];
5 }
6
7 - (IBAction)tap2:(id)sender {
8
9 UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
10 UIViewController *one = [storyboard instantiateViewControllerWithIdentifier:@"two"];
11 [self.revealSideViewController popViewControllerWithNewCenterController:one animated:YES];
12
13 }
14
15 - (IBAction)tap3:(id)sender {
16 UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
17 UIViewController *one = [storyboard instantiateViewControllerWithIdentifier:@"three"];
18 [self.revealSideViewController popViewControllerWithNewCenterController:one animated:YES];
19 }
20
21 - (IBAction)tap4:(id)sender {
22 UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
23 UIViewController *one = [storyboard instantiateViewControllerWithIdentifier:@"four"];
24 [self.revealSideViewController popViewControllerWithNewCenterController:one animated:YES];
25 }
5.各个页面返回到主界面的代码如下:
1 - (IBAction)tapPage:(id)sender {
2 UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
3
4 UIViewController *view = [storyboard instantiateViewControllerWithIdentifier:@"NavigationController"];
5
6 [self.revealSideViewController popViewControllerWithNewCenterController:view animated:YES];
7 }
四.到此效果实现完毕,下面是效果图:


sales@spasvo.com