heightforrowatindexpath

Implement heightForRowIndexPath: in iOS 7, but remove it in iOS 8 using compile-time macro

核能气质少年 提交于 2019-12-10 09:42:19
问题 I'd like to implement the new auto-resizing table view cells in iOS 8, while maintaining support for heightForRowAtIndexPath: in iOS 7. The problem is I have to remove the method override heightForRowAtIndexPath: for iOS 8, but keep in it for iOS 7. Is there some compile-time macro to use that will accomplish this? 回答1: You can not use a compile time macro because this is a run time decision. Instead, you can just return UITableViewAutomaticDimension for iOS 8 and if not, return your

Swift TableView Crash: “Missing cell for newly visible row”

好久不见. 提交于 2019-12-09 21:41:44
问题 Im experiencing a crash when adding new rows to a tableview. In short, the crash log says "Missing cell for newly visible row 3". Reproduction 1. Add N amount of objects to datasource 2. Manually add the same amount of cells to tableview 3. Reload and animate using beginUpdates - endUpdates Known Problem This crash has already been discussed at question and reported at Apple. Their solution to this problem (not using estimated cell heights) does not work for me as i need 2 different heights

Implement heightForRowIndexPath: in iOS 7, but remove it in iOS 8 using compile-time macro

▼魔方 西西 提交于 2019-12-06 02:27:46
I'd like to implement the new auto-resizing table view cells in iOS 8, while maintaining support for heightForRowAtIndexPath: in iOS 7. The problem is I have to remove the method override heightForRowAtIndexPath: for iOS 8, but keep in it for iOS 7. Is there some compile-time macro to use that will accomplish this? You can not use a compile time macro because this is a run time decision. Instead, you can just return UITableViewAutomaticDimension for iOS 8 and if not, return your calculated height value. #define IS_IOS_8_OR_LATER ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) -

How do I change the height of a table cell that has already loaded?

狂风中的少年 提交于 2019-12-05 20:33:37
Currently I have webviews loading in customized uitableview cells. The problem is the web views have variable sizes. In webViewDidFinishLoad I am able to set the size of the web view based on the actual size of the html document just fine. My problem is the table cells which have already had their height set in heightForRowAtIndexPath before the web views having finished loading. How can I change the height of a table cell after it has already been loaded? Ideally I feel like I should be able to use some line of code like this. cellW.frame = cellW.cellWebView.frame; However I don't seem to

Load custom UITableViewCell from Storyboard

删除回忆录丶 提交于 2019-12-05 00:18:21
问题 Currently I'm using auto layout with storyboard to dynamically resize custom UITableViewCell 's. Everything is working as it should except there is memory leak when scrolling. I know the problem is from calling [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier]; from inside - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath My question is this, what would be the best way to create a reference cell? How to load a cell from storyboard

Swift TableView Crash: “Missing cell for newly visible row”

↘锁芯ラ 提交于 2019-12-04 17:22:58
Im experiencing a crash when adding new rows to a tableview. In short, the crash log says "Missing cell for newly visible row 3". Reproduction 1. Add N amount of objects to datasource 2. Manually add the same amount of cells to tableview 3. Reload and animate using beginUpdates - endUpdates Known Problem This crash has already been discussed at question and reported at Apple . Their solution to this problem (not using estimated cell heights) does not work for me as i need 2 different heights for the cells. My tableview is composed out of 2 different cell classes. Both have their own standard

Load custom UITableViewCell from Storyboard

断了今生、忘了曾经 提交于 2019-12-03 14:18:31
Currently I'm using auto layout with storyboard to dynamically resize custom UITableViewCell 's. Everything is working as it should except there is memory leak when scrolling. I know the problem is from calling [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier]; from inside - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath My question is this, what would be the best way to create a reference cell? How to load a cell from storyboard without dequeueReusableCellWithIdentifier ? And is it ok to maybe call dequeueReusableCellWithIdentifier

estimatedHeightForRowAtIndexPath can in fact change the final “correct” height of a row?

筅森魡賤 提交于 2019-12-03 06:08:19
问题 I've just discovered an astounding problem or counter-intuituve behaviour when using estimatedHeightForRowAtIndexPath (1) My table has wildly varying row heights. The final results can range from 111 to about 400. (2) I absolutely perfectly calculate each row height. I have these on hand in an array, that is to say cached. {Note that this is exactly what, apparently, Apple engineers now recommend...example, point 5 .. Using Auto Layout in UITableView for dynamic cell layouts & variable row

estimatedHeightForRowAtIndexPath can in fact change the final “correct” height of a row?

青春壹個敷衍的年華 提交于 2019-12-02 19:35:34
I've just discovered an astounding problem or counter-intuituve behaviour when using estimatedHeightForRowAtIndexPath (1) My table has wildly varying row heights. The final results can range from 111 to about 400. (2) I absolutely perfectly calculate each row height. I have these on hand in an array, that is to say cached. {Note that this is exactly what, apparently, Apple engineers now recommend...example, point 5 .. Using Auto Layout in UITableView for dynamic cell layouts & variable row heights } (3) When heightForRowAtIndexPath asks for a height, I do give it absolutely the correct height.

how to obtain the UITableViewCell within heightForRowAtIndexPath?

随声附和 提交于 2019-11-30 11:21:49
问题 How does one obtain the UITableViewCell when within the heightForRowAtIndexPath method, i.e. given the indexPath? (then I could access the content views I have created to add their heights up) - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { // How to get the UITableViewCell associated with this indexPath? } thanks EDIT: In fact is there really a valid way to do this? When I put some NSLog statements it seems that heightForRowAtIndexPath it