我需要在iOS通用应用程序(iPhone / iPad)上呈现表格视图。我正在寻找一种简单的方法来在肖像和风景上制作不同的专栏
我的目标
iPhone portrait has 3 labels
iPad portrait has 6 labels
iPhone&iPad landscape has 6 labels
我应该以编程方式或使用大小类或其他方式?
请向我解释。
谢谢
答案 0 :(得分:0)
1) [[UIDevice current] userInterfaceIdiom] for determine iPhone or iPad
2) [[UIApplication sharedApplication] statusBarOrientation] for determine current orientation
通过UIApplicationDelegate获取事件
- (void)application:(UIApplication *)application willChangeStatusBarOrientation:(UIInterfaceOrientation)newStatusBarOrientation duration:(NSTimeInterval)duration;
- (void)application:(UIApplication *)application didChangeStatusBarOrientation:(UIInterfaceOrientation)oldStatusBarOrientation;
或者您可以订阅NSNotificationCenter中的通知
UIApplicationWillChangeStatusBarOrientationNotification;
UIApplicationDidChangeStatusBarOrientationNotification;
UIApplicationStatusBarOrientationUserInfoKey;