[英]How to make UITableView different colume on portrait and landscape?
I need to present table view on iOS universal app (iPhone/iPad). 我需要在iOS通用应用程序(iPhone / iPad)上呈现表格视图。 I'm seeking a simple way to make different column on portrait and landscape 我正在寻找一种简单的方法来在肖像和风景上制作不同的专栏
My target 我的目标
iPhone portrait has 3 labels
iPad portrait has 6 labels
iPhone&iPad landscape has 6 labels
I should be programatically or use size classes or the other way ? 我应该以编程方式或使用大小类或其他方式?
Please explain to me. 请向我解释。
Thank you 谢谢
1) [[UIDevice current] userInterfaceIdiom] for determine iPhone or iPad
2) [[UIApplication sharedApplication] statusBarOrientation] for determine current orientation
And via UIApplicationDelegate get events 并通过UIApplicationDelegate获取事件
- (void)application:(UIApplication *)application willChangeStatusBarOrientation:(UIInterfaceOrientation)newStatusBarOrientation duration:(NSTimeInterval)duration;
- (void)application:(UIApplication *)application didChangeStatusBarOrientation:(UIInterfaceOrientation)oldStatusBarOrientation;
Or you can subscribe on notifications in NSNotificationCenter 或者您可以在NSNotificationCenter中订阅通知
UIApplicationWillChangeStatusBarOrientationNotification;
UIApplicationDidChangeStatusBarOrientationNotification;
UIApplicationStatusBarOrientationUserInfoKey;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.