简体   繁体   English

如何在肖像和风景上制作UITableView不同的colume?

[英]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.

相关问题 如何在横向模式下使完成的人像布局不同 - How to make a finished portrait layout different in landscape mode 如何使 MPMoviePlayerController 横向全屏而不是纵向全屏 - How to make MPMoviePlayerController fullscreen in landscape and not fullscreen in portrait 如何在flutter中显示横向和纵向的不同布局 - How to show different layout for landscape and portrait in flutter 如何在纵向和横向中提供两种不同的视图? - How to provide two different views in portrait and landscape? 不同的风景和肖像设计 - Different landscape and portrait design 纵向和横向模式的不同 UITableViewCell - Different UITableViewCell for Portrait and Landscape Mode 纵向和横向模式下的不同布局 - Different layouts in portrait and landscape mode UITableView在从纵向旋转到横向再回到纵向时更改大小 - UITableView changes sizes when rotated from portrait, to landscape, back to portrait 如何在不同的iPhone屏幕尺寸下使用纵向和横向自动布局 - how to use auto layout in portrait and landscape for different iphone screen sizes 如何在横向和纵向模式下仅制作MPMoviePlayerController - How to make only MPMoviePlayerController in both landscape and portrait mode
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM