需要帮助检查 iPad 的方向
可能的重复:
iPhone 方向
根据 iPad 的方向,我需要设置表格视图的背景或将其删除,因为它不适用于弹出窗口。
我尝试过,但没有运气:
if( [UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationLandscapeLeft ){
self.navigationController.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"background.png"]];
self.tableView.backgroundColor = [UIColor clearColor];
NSLog(@"test");
也许有更好的方法?查看表格是主表格还是弹出窗口,然后设置背景?
Possible Duplicate:
iPhone orientation
Depending on what orientation the iPad is in, I need to either set the table view's background or remove it because it doesn't work with the popover.
I tried this but no luck:
if( [UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationLandscapeLeft ){
self.navigationController.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"background.png"]];
self.tableView.backgroundColor = [UIColor clearColor];
NSLog(@"test");
Maybe there is a better way? To see if table is master or popover, then set background?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有几种方法可以或多或少地实现您想要的效果:
如果您选择选项 1,那么您可以像这样检查方向:
编辑:要让您的应用程序自动旋转,您可以执行以下操作:
There are several ways to achieve what you want, more or less:
UIInterfaceOrientation orientation = [[UIDevice currentDevice] orientation];
If you go with option 1, then you can check the orientation like so:
EDIT: To get your application to automatically rotate, you can do this: