Featured post
iphone - how to display table view cells whenever we need to click on one cell -
i writing 1 app in app have display tableview 2 cells.while first cell touched user have show other cells within view (i cant use navigation here) , second cell visible..can 1 tell me suggestion this. thank all.
if want insert table view cells when clicking on cell, try following code.
lets consider going insert 3 rows in position 1, 2 , 3 in section 0. in didselectrowatindexpath method, following. here rows inserted in section 0, if select row 0(first row) in section 0(first section).
- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath {     if (indexpath.row == 0 && indexpath.section == 0) {         // create indexpaths rows going insert         nsindexpath *indexpath1 = [nsindexpath indexpathforrow:1 insection:0]];        nsindexpath *indexpath2 = [nsindexpath indexpathforrow:2 insection:0]];        nsindexpath *indexpath3 = [nsindexpath indexpathforrow:3 insection:0]];         // increase number of rows in section 0 3, inserting 3 rows here         numberofrowsinsectionzero = numberofrowsinsectionzero + 3;         // insert rows         [self.tableview insertrowsatindexpaths:[nsarray arraywithobjects:indexpath1, indexpath2, indexpath3, nil] withrowanimation:uitableviewrowanimationfade];     } } in numberofrowsinsection method, should having following,
- (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection: (nsinteger)section {      // code here      if (section == 0) return numberofrowsinsectionzero;      // code here } and make sure having appropriate code in cellforrowatindexpath method display content in newly displayed rows.
note: have alter code in such way rows not inserted when clicking row 0 of section 0, when been inserted.
- Get link
- X
- Other Apps
Comments
Post a Comment