当从 cellForRowAtIndexPath
调用 textView becomeFirstResponder
时返回 false,为什么?
但是从其他方法,即从 didSelectRowAtIndexPath
可以工作。
是否与我使用 iOS 8 引入的 UITableViewAutomaticDimension
行高方法有关?!
最佳答案
当您查看文档时,它说 View 必须位于 View 层次结构中。我认为在 cellForRowAtIndexPath 方法中, TextView 尚未附加到层次结构,而是在返回单元格时。
You may call this method to make a responder object such as a view the first responder. However, you should only call it on that view if it is part of a view hierarchy. If the view’s window property holds a UIWindow object, it has been installed in a view hierarchy; if it returns nil, the view is detached from any hierarchy.
关于ios - becomeFirstResponder 在 cellForRowAtIndexPath 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32526673/