ios - Insert different cell in UITableView dynamically objective c -


i have created cell(cell_1) in tableview.

i want....

when user click on cell_1 new cell(cell_2) or row gets inserted in table view. new cell defined in xib.

i try insertrowsatindexpaths insert same cell(cell_1)

i using xib.

make sure have add mutliple cells @ runtime not compile time.only when user click on cell_1 , new cell(cell_2 ) insert.

example:- iphone's contact app. when user click on add phone new cell appears. enter image description here

you must first insert particular cell value in tableview datasource. when insertrowsatindexpaths call cellforrowatindexpath , return cell_2. returning cell_1 in cellforrowatindexpath.

- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     if() { //check condition          //create , return cell_1     }     else { //identify condition cell 2          //create , return cell_2     } } 

Comments