首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >更改UIDeviceOrientation时的奇怪行为

更改UIDeviceOrientation时的奇怪行为
EN

Stack Overflow用户
提问于 2011-08-29 20:59:21
回答 1查看 253关注 0票数 0

当我改变方向时,我会这样做。

代码语言:javascript
复制
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
    if((self.interfaceOrientation == UIDeviceOrientationPortrait) || (self.interfaceOrientation == UIDeviceOrientationPortraitUpsideDown))
    {    
        [self.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"auto_main_hor.png"]]];
        [UIView commitAnimations];

    } else if((self.interfaceOrientation == UIDeviceOrientationLandscapeLeft) || (self.interfaceOrientation == UIDeviceOrientationLandscapeRight))
    {
        [self.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"auto_main_vert.png"]]];
    } 
}

当我急剧旋转设备180度时,我得到了一些错误显示?我怎么才能修复它?

EN

回答 1

Stack Overflow用户

发布于 2011-10-28 09:56:28

请注意,UIInterfaceOrientationUIDeviceOrientation不是一回事。您正在使用设备方向,而您应该使用接口方向。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7230410

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档