Best approach for editing text fields in a table view cell

后端 未结 3 1441
暗喜
暗喜 2021-01-03 03:05

In my app I\'ve got a number of views that need to be in-place editable. I\'ve got the tableviewcells setup to include a UITextF

3条回答
  •  鱼传尺愫
    2021-01-03 03:34

    • Subclass UITableViewCell and add a UITextField in it's init method.

    • create a protocol for the custom cell class. when UITextField begin editing or end editing call the delegate's method.

    • in controller, implement the custom cell's protocol and set the indexpath row value to cell's tag in tableView:cellForRowAtIndexPath:

    so every time you edit UITextField, you can know in controller which row is editing (via cell's tag)

提交回复
热议问题