uitableview - Explicitly set row height for some rows but use estimatedRowHeight for others -


i have uitableviewcell contains uiwebview subview. web view fills entire cell. using estimatedrowheight calculate row height. however, @ time table view built, cell has no height because web view has not loaded it's content, therefore cell has no content. because of this, estimatedrowheight returns 44 instead of correct height of web view content.

does know how can correctly calculate height of row when content not set? there way estimate height of cells , explicitly set heigh of other cells, in same table view?

this how using estimatedrowheight:

self.tableview.estimatedrowheight = 200; self.tableview.rowheight = uitableviewautomaticdimension; 

i not using delegate method. have tried it, not change result. cell using has xib uses auto layout constraints. clear, cell appear , web view added cell. problem height of cell not big enough show entire web view. web view loads html embed code audio player.

i did fiddling around , found out can use uitableviewautomaticdimension in following way:

- (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath {     tablesection *tablesection = (self.tablemodel.sections)[indexpath.section];      if (tablesection.sectiontype == tablesectiontypewebview)     {         return 120;     }     else     {         return uitableviewautomaticdimension;     } } 

this says, use height of 120 webview sections else want figure out height. using own custom table model here (i.e. tablesection, sectiontype, etc...)

i had add self.tableview.estimatedrowheight = 200; init method work.

now can provide estimated row height explicitly set row height sections, or rows if wanted.

i haven't seen documentation this, tested variable length strings , held fine.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -