UITextView in a UITableViewCell: first responder problem
I have a UITextView in a UITableViewCell which grows together with it. Using
[myTableView beginUpdates];
[myTableView endUpdates];
in textViewDidChange
and setting the height of the cell properly, I'm getting close to the solution.
But I've a problem tied to the first responder.
I set the textview in my custom cell to become the first responder ('cause I want to start with the open keyboard) on开发者_高级运维 the view loading, but the textview is nil in viewDidLoad
, viewWillAppear
, viewDidAppear
, only when I write a char I can see it's not nil.
I connected the textview in the IB custom cell with an IBOutlet in my viewcontroller.
I resolved putting
[myTextView becomeFirstResponder];
in
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
精彩评论