How can we make a universal application in Xcode so that if the iPhone view has a table view the iPad has a collection view? I can't think of how we can do this using size classes.
This is how I would do it.
Use an if/else clause to see what device is running your app and depending upon the answer hide the view.
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { //its iphone, hide UICollectionView //ie myCollectView.hidden=YES; } else { //its ipad, hide UITableView //ie mytableView.hidden=YES; }
您应该选择尺寸分类和自动布局。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.