Table Cell SubView Iteration Not Finding TextField

前端 未结 4 460
面向向阳花
面向向阳花 2021-01-17 07:03

I\'ve created a table where each cell holds both a text label and a text field. I\'m adding the textfields as such [cell addSubview:passwordField]; and from a v

4条回答
  •  一生所求
    2021-01-17 07:52

    2 things occur to me:

    1. In the long run it'll be easier to create a UITableViewCell which contains a UITextField which is accessible as a property. You can either use a nib to layout the cell or do it programmatically in the cells init method. This approach will make your code easier to manage.

    2. You need to consider cell reuse. If you are reusing cells (which you should be) then you will need store the fetch the value from the textfield before it is reused.

提交回复
热议问题