Uitable automatic cell height adaptation and uitable cell adaptation
Uitable cell height automatic adaptation of the premise is that you want to enable the auto layout option, do not understand or not familiar with the first look here http://lvwenhan.com/ios/430.html
Follow the steps in many use cases, but do not want to step on it:
1. Disable proxy function-(CGFloat) tableView :( UITableView *) tableView heightForRowAtIndexPath :( NSIndexPath *) indexPath;
2. Then implement-(CGFloat) tableView :( UITableView *) tableView estimatedHeightForRowAtIndexPath :( NSIndexPath *) indexPath
Note that the two proxy functions look very similar, but the names are indeed different. EstimatedHeightForRowAtIndexPath is a new API provided from iOS7. It is more efficient than heightForRowAtIndexPath, because it only obtains the height of the cells to be displayed. After an internship on a case-based basis, the cell height remains unchanged and will not be adaptive.
Finally, I tried another method and finally succeeded. The method is as follows:
1. Neither heightForRowAtIndexPath nor estimatedHeightForRowAtIndexPath;
2. Set the following attributes for uitable:
TableView. estimatedRowHeight = 10.0;
TableView. rowHeight = UITableViewAutomaticDimension;
Run the command and you will see the effect. Why is the first method not working? I think there may be a lack of steps. I have copied a large copy of the article on the internet, and I guess I have not tested it, so I will reprinted it. Have time to see where the problem with the first method is.
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.