当表格进入“编辑”模式时,如何使表格单元格UITextField可编辑? [英] How can I make my table cell UITextField editable when the table has entered 'edit' mode?
本文介绍了当表格进入“编辑”模式时,如何使表格单元格UITextField可编辑?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个可编辑的简单表格视图。我需要用户能够做的就是在他们选择编辑表时编辑单元格中的文本字段。
I have a simple table view which is editable. All I need the user to be able to do is edit the text field in the cell when they choose to edit the table.
推荐答案
您需要子类化UITableViewCell以使其可以内联编辑。默认实现只包含UILabel,它们是不可编辑的。例如,如果你的单元格中有一个UITextField视图,你将覆盖 - (void)setEditing:(BOOL)编辑动画:(BOOL)动画
并制作文本领域成为第一响应者。
You need to subclass UITableViewCell to make it editable inline. The default implementation just contains UILabels, which are not editable. For example, if you had a UITextField view in your cell, you'd override - (void)setEditing:(BOOL)editing animated:(BOOL)animated
and make the text field become the first responder.
这篇关于当表格进入“编辑”模式时,如何使表格单元格UITextField可编辑?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文