旋转景观和肖像

时间:2011-10-11 05:53:59

标签: ios uiview

我在UIView中有旋转问题,在UIView我有UIimage和UI工具栏 当我改变不同的旋转时,UIImage和UIToolBar也应该改变

2 个答案:

答案 0 :(得分:1)

对于iOS 6,在视图控制器中执行此操作,

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return UIInterfaceOrientationIsPortrait(interfaceOrientation);
}

- (BOOL)shouldAutorotate {
    return YES;
}

- (NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskPortrait
         | UIInterfaceOrientationMaskPortraitUpsideDown
         | UIInterfaceOrientationLandscapeLeft;
}

这将使人像方向,倒置肖像和风景向左。

答案 1 :(得分:0)

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}

http://goodliffe.blogspot.com/2009/12/iphone-forcing-uiview-to-reorientate.html

查看此网站了解更多详情。