Universal storyboard UITableview row Height

左心房为你撑大大i 提交于 2019-12-12 03:26:34

问题


Using Storyboard sizeClasses i want to define the different TableView Row Height

  • Using UITableView Row Height Automatic based on screen height (Specially in iPad)
  • Using Static TableView i Also want to achieve the Dynamic Row so that we can utilize the screen Height

It might be possible that the Question is very old and may be its duplicate also but i have searched and not getting proper result so its better i should ask this again might be something new in Xcode 7 with iOS 9 so guys anyone have any good resource which fullfill my requirement please share it, Thanks is advanced


回答1:


You can set the row height in heightForRowAtIndexPath: delegate method of UITalbeView.

You can get the trait-collection details and then use it to identify the current size class.

NSInteger horizontalClass = self.traitCollection.horizontalSizeClass;
NSInteger verticalCass = self.traitCollection.verticalSizeClass;

switch (horizontalClass) {
    case UIUserInterfaceSizeClassCompact :
        // horizontal is compact class.. do stuff...
        break;
    case UIUserInterfaceSizeClassRegular :
        // horizontal is regular class.. do stuff...
        break;
    default :
        // horizontal is unknown..
        break;
}

Then you can calculate or set a predefined row height as per device height.



来源:https://stackoverflow.com/questions/33189779/universal-storyboard-uitableview-row-height

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!