Managing Delegate of UITextFields in Custom UITableViewCell

后端 未结 5 1592
长情又很酷
长情又很酷 2021-01-17 13:05

So I have looked around a quite a bit, and nothing on here seems to explain exactly the correct way of doing this. I have 7 UITextFields within a custom UITableViewCell.

5条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-17 13:54

    In my opinion the cell should manage the keyboard since it is the one that is holding the UITextField. You can set your cell as the UITextField delegate. In my own application, I have done this and then made my cell have it's own delegate. Any of the methods of UITextField or any new methods that should be handled by the controller can be passed along to the controller through the cells delegate.

    In this way the cell can still be generic without knowing anything about what the application is actually doing.

提交回复
热议问题