从另一个控制器返回后,IOS方向未更改
我是IOS开发的新手,这是我第一个在iPad和iPhone上处理不同方向的应用程序 这是一个场景, 我实现这个函数是为了处理定向问题,它对我来说很好从另一个控制器返回后,IOS方向未更改,ios,uiimage,orientation,Ios,Uiimage,Orientation,我是IOS开发的新手,这是我第一个在iPad和iPhone上处理不同方向的应用程序 这是一个场景, 我实现这个函数是为了处理定向问题,它对我来说很好 - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration 但是,当我转到另一页并更改方向(例如:横向),然后再次返回到第一页(例如:仍处于横向模
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
但是,当我转到另一页并更改方向(例如:横向),然后再次返回到第一页(例如:仍处于横向模式),UIImage的背景不再更改
我非常感谢您的回答,谢谢
或者,如果使用xib,只需检查自动访问掩码,或者设置类似lbltitle.autoresizingMask=UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth…如何将图像分配给视图?hi@AlexSmith我使用此选项分配图像
UIImage*backgroundImage=[UIImage imageNamed:@“bg.png];UIColor*backgroundPattern=[uicolorWithPatternImage:backgroundImage];[self.view setBackgroundColor:backgroundPattern]代码>我在重新创建您的问题时遇到问题。我创建了一个带有故事板的单视图项目,其中我有两个视图,ViewController1作为UINavigationController和ViewController2的rootViewController
。我只实现了-willanimaterotationInterfaceOrientation:duration:
,我没有任何问题。。。抱歉。嗨@AlexSmith我忘了提到你,在视图的顶部我放置了子视图,并将图像指定为容器的背景,所以问题发生在这里,在这个子视图上。那么,主视图是改变方向还是只改变子视图?