0

I my application i have to count cell height dynamically and i support iOS7 and iOS8 for my app. I'm following Ray wenderlich tutorial for this purpose. After spending a whole day on this i came to know that this technique only works if size classes are disabled for the app.

So my question is how to calculate row height using auto layout(constraints) if size classes are enabled?

Blios
  • 719
  • 1
  • 16
  • 30

2 Answers2

0

Automatically height calculation is working only in IOS 8 and above when you are using Constraint in your application. It is not depend on size classes. You can use Constraint without size classes too. Check that link

Thanks

Community
  • 1
  • 1
Hindu
  • 2,894
  • 23
  • 41
  • I'm using auto layout to calculate row height but it not works if size classes are enabled. So how to calculate row height using auto layout(constraints) if size classes are enabled? – Blios Jul 13 '15 at 06:14
  • When you are using auto layout, frames can not be set. you need to set Constraint values such as http://stackoverflow.com/questions/31339702/presenting-a-view-controller-modally-resets-the-current-view/31340210#31340210 – Hindu Jul 13 '15 at 07:00
0

You can try setting the row height to UITableViewAutomaticDimension in viewDidLoad (but I don't think it'll work with iOS 7)

self.tableView.estimatedRowHeight = 44; // need to calculate against something
self.tableView.rowHeight = UITableViewAutomaticDimension;
Islam
  • 3,654
  • 3
  • 30
  • 40
  • I'm able to get cell height by using auto layout and constraints(in both iOS7 and iOS8), but it only works if i disable size classes. – Blios Jul 13 '15 at 08:42