几种常用的办法:
1.在一个viewcontoller中同时初始化3个view,一层盖住一层,当需要显示那一层的时候,用
[self bringSubviewToFront:view1];//将view1放到第一层
这样就会显示view1,同理在view2,view3上都可以,想显示那一层,就把那一层提到最前面来
-(IBAction)goView1:(id)sender
{
[self.view bringSubviewToFront:view1]; //将view1盖在其他的view上面
[self.view addSubview:view1]; //在当前的view上添加一个view也会盖住这个view
[self.view exchangeSubviewAtIndex:0 withSubviewAtIndex:1]; //用下标是1的view盖住下标是0的view
//个人理解,仅供参考
}
2.navctionController。也就是iphone上使用的。
3.模态方式加载view
presentModalViewController。
[self
presentModalViewController:controllerA animated:
YES
];
设置模态窗口的样式
controllerA.modalPresentationStyle = UIModalPresentationFormSheet//背景 |
controllerA.modalPresentationStyle = UIModalPresentationFullScreen//全屏 |