我想使用不同于纵向模式的UIView,这是可能的吗?如果可以,我该怎么做?
发布于 2011-03-17 01:17:24
在.h文件中获取一个全局变量,即"currentOrientationView“。当你的设备从任何接口方向旋转时,它将调用"WillRotateToInterfaceOrientation:",这个方法有一个参数,告诉设备要旋转到的接口方向,所以把你的条件放在这个方法中,并用相应的视图设置"currentOrientationView“的值为:
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
if (UIInterfaceOrientationIsPortrait(toInterfaceOrientation)) {
currentOrientationView=potraitView;
}else {
currentOrientationView=landscapeView;;
}}发布于 2011-03-16 05:25:16
您必须使用面向shouldAutorotatetointerface的方法,并且在此方法中必须放入如下代码
self.addSubview:newView;
发布于 2011-03-16 05:29:31
使用willRotateToInterfaceOrientation交换视图。对于你想支持的所有方向,shouldAutorotateToInterfaceOrientation应该返回YES。
https://stackoverflow.com/questions/5318099
复制相似问题