ios - Resize TableCell on select/deselect -


i'm new ios , monotouch, , have pretty basic need - have 2 vastly different views display in same table cell depending on whether selected or not. when load app i'll present list of products in custom uitableview, rows deselected , each row showing product names in label. user taps 1 of rows , selects it, show different view more of shopping cart layout. since 2 views different have vastly different sizes. need cell (or row?) grow , shrink according natural height of whichever view being displayed.

i'm using descendants of uitableviewcontroller, uitableviewsource, , uitableviewcell solution. add both versions cell's contentview, set hidden property needed when cell/row selected/deselected show right layout. works well. i'm in demo mode right now, i'm not overly worried efficiency or responsiveness, have come later.

i know getheightforrow responsible sizing rows gets called once, when cell first shown. seems me need alert tableview re-poll source new size views changing, can't figure out how it.

i tried (rather hopefully) cause getheightforrow invoked again manually using cell.setneedslayout , cell.setneedsdisplay, hoping cause table re-query source new dimensions, no joy.

i tinkered direct approach, trying size contentview didn't seem if leading anywhere. feel if table needs told query new row size, i'm open suggestions.

surely i'm not first attempt this? missing?

try forcing getheightforrow called again calling reloadrows instead.

you may or may not have specify begin/end updates (this might animation, though?)

tableview.beginupdates(); tableview.endupdates(); 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -