swift - Reload TableView after clicking on a custom cell's UITextField -


i have tableview custom cells. each custom cell has textfield. when user clicks on textfield, want new cells appear on screen.

this i'm trying:

func textfieldshouldbeginediting(textfield: uitextfield) -> bool {     /*     ...code determine new cells should added in data structure     */     self.tableview.reloaddata()     return true } 

however, every time reloaddata called, think delegate calls textfieldshouldbeginediting again, stuck in infinite loop , method never returns.

any ideas on how can avoid problem?

i think looking insertrowsatindexpaths call instead of reloading whole table.

  func insertrowsatindexpaths(_ indexpaths: [nsindexpath], withrowanimation animation: uitableviewrowanimation) 

another stack overflow post should at

here's link apple docs

keep in mind when doing need keep datasource date well. update datasource before calling insertrowsatindexpath


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -