整体是支持横竖屏的,但某个页面要只支持横屏,不支持竖屏。 有没有办法?
不要用presentModalViewController,因为这个页面不是模态的。
------解决方案--------------------
-?(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
????return?(interfaceOrientation?!=?UIInterfaceOrientationMaskLandscapeLeft);
}
-(NSUInteger)supportedInterfaceOrientations
{
????return?UIInterfaceOrientationMaskLandscapeRight;
}
-(BOOL)shouldAutorotate
{
????return?YES;
}
UIDeviceOrientationLandscapeLeft还是UIDeviceOrientationLandscapeRight,,自己试下。
------解决方案--------------------
设置这个view 的superview离开是不是就可以解决问题了?
self.blueViewController.view.superview == nil
------解决方案--------------------
改变这个view的frame:
在相对应的视图控制器(ViewController.m)的viewDidLoad方法中加入下面代码
CGAffineTransform transform = CGAffineTransformIdentity;
transform = CGAffineTransformRotate(transform, M_PI/2);
self.view.transform = transform;
注意此时视图横屏了但是状态栏还是纵屏显示的,所以需要修改状态栏方向(alertview的方向也会随之修改)
[[UIApplication sharedApplication]setStatusBar。。。。。