简体   繁体   中英

Insert New cell dynamically below the current cell, when a Plus Button is pressed

I would like to insert a new cell below the current cell, once a plus button is pressed in a tableview. The new cell will be of different height with a UIview as a subview with some custom buttons on it. upon clicking the plus symbol again , the table collapses.

Is there a specific way in ios to do it easily?

Insert new row in UITableView when tapping first row

is this the only possible mechanism or is there any simple method?

There are other methods like you can add or remove object from your array with addObject and removeObject in didSelectRow and then reload your table. Still I guess simplest way will be to use insertRowsAtIndexPaths and deleteRowsAtIndexPaths .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM