Xib 视图文件无法在横向模式下工作
我在我的项目中添加了新的 Xib 视图文件。我分配给视图控制器并在我设置的视图控制器中:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
//return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
return YES;
}
但是当应用程序以横向模式运行时,xib 不处于横向模式。我已经在 info.plist 文件中设置了 xib 文件也在横向视图中。我必须做什么?有什么帮助吗?
I have added new Xib view file in my project. I assigned to view controller and in the view controller I set:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
//return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
return YES;
}
But when the application runs in landscape mode, xib is not in landscape mode. I have set in info.plist file also xib file is also in landscape view. What do I have to do? Any help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要调整视图上元素的对齐方式,以便在旋转时元素将根据方向占据其位置。
例如,如果您的左下角有一个按钮,则在对齐窗格中,您应该将其指定为粘在左侧和底部,同时保持其原始大小。此外,包含视图必须完全可自动调整大小。
您可以通过这样的代码来完成:
希望这有帮助
You need to adjust the alignment of elements on your view in the way, that when it rotates the elements will take their place according to orientation.
for example if you have a button on your left bottom corner, in the alignments pane you should assign it to stick to left and bottom, while maintaining its original size. Also the containing view has to be fully autoresizable.
You can do it from the code like this:
Hope this helps