ios - Get UITableViewCell from indexPath not Working -


i trying updated cell item while updating height of cell not working.

[_tblbillhistory beginupdates]; [_tblbillhistory endupdates]; 

these method have used updated cell height

err- > exc_bad_access(code=2,address=0x7fff5b4daf98) error message getting cellforrowatindexpath method. nslog printing selected row correctly. idea??? thank you.

- (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath {     if((selectedpath!=nil ) & ([indexpath isequal:selectedpath])) {         nslog(@"%ld",indexpath.row);         uitableviewcell *tempcell = [_tblbillhistory cellforrowatindexpath:indexpath];          uistackview *stkitems=(uistackview *)[tempcell viewwithtag:8];          for(int i=0;i<20;i++)         {             uibutton *btn=[uibutton buttonwithtype:uibuttontypesystem];             [btn settitle:@"test button" forstate:uicontrolstatenormal];             [stkitems addarrangedsubview:btn];         }          return 700;     }      return 250; } 

i think method not place update cell's components.
if want add element cell can create @ other methods, example:

- tableview:willdisplaycell:forrowatindexpath: 

heightforrowatindexpath may called many times (every reloaddata or animation block).

you should divide code, in heightforrowatindexpath should calculate height without request cell (because tableview not have cells in method). adding or removing elements cell can create in didselectmethod (but more better solution move code cell or create custom class selected cell):

 - tableview:didselectrowatindexpath: 

Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -