ios - 调用 'becomeFirstResponder()' 的结果是 UITableView 中未使用的 UITextField

标签 ios swift uitableview uitextfield

我试图将光标放在 UITableView 中的第一个 UITextField 中,并让键盘显示为这样写的。

if (indexPath.row == 0) {
    cell.inputTextField.becomeFirstResponder()
}

但是警告显示是这样的。

Result of call to 'becomeFirstResponder()' is unused

如何将光标放在第一个 UITextField 上,让 KeyBoard 显示出来?

最佳答案

我在覆盖'becomeFirstResponder'时遇到它,如果你想删除它,你可以使用 @discardableResult

关于ios - 调用 'becomeFirstResponder()' 的结果是 UITableView 中未使用的 UITextField,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48900317/

相关文章:

ios - 在 UITableViewCell 中水平居中放置两个 UILabel

ios - 单独选择SegmentedControl的字体

mysql - 如何使用标准输入在 Swift 3.0 中运行进程

ios - 快速加载两个 Collection View 和一个 TableView 的核心数据

swift - Xcode6 无法使用类型的参数列表调用 'subscript'

iphone - 如何让UITableViewCell中的图片平滑滚动?

ios - 如何在 iOS 中枚举家庭视频?

ios - 当我使用手势识别器时,表格 View 不滚动

ios - SceneKit:如何在不禁用 PBR 的情况下在 iOS 10 上重现 iOS 9 灯光颜色效果(一个方向,一个环境)?

objective-c - 在具有 "dynamic prototypes"的静态 Tableview 中包含具有 "static cells"的部分