将视图从风景转换为人像?
问题描述:
我已经开发了横向模式的应用程序,现在客户端要求以横向和纵向模式构建。将视图从风景转换为人像?
如何将横向视图转换为纵向视图?
现在我使用这个代码园林景观:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
请帮我....
先谢谢:)
答
了解如何使用自动尺寸口罩。他们很简单,但在大多数情况下非常强大。
答
很简单,支持所有的方向只需要返回YES
到shouldAutorotateToInterfaceOrientation
。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
//Or to support all but portrait upside down
return interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown;
}
答
NSPostWhenIdle是正确的。您只需返回yes shouldAutorotateToInterfaceOrientation。这样你可以支持所有的方向。看看通过XIB调整属性的大小。这也将使您的工作变得轻松。