I have a custom UITableViewController that uses a custom cell that displays a text field. I have this method added to the table view controller to set the text field as first responder

- (void)viewWillAppear:(BOOL)animated
{
        [super viewWillAppear:animated];
        
MLPropertyEditingTableViewCell* __cell = (MLPropertyEditingTableViewCell*)[self.tableView cellForRowAtIndexPath: [NSIndexPath indexPathForRow:0 inSection:0]];
        
    [__cell.textField becomeFirstResponder];
}

This works on iPhone OS 3.0, but not on iPhone OS 3.1. It appears that on 3.1 there is an observer that calls reloadData on the table view and that forces the first responder to resign.

#0 0x00007b9d in -[FRProjectNamePropertyEditorViewController textFieldDidEndEditing:] at FRProjectNamePropertyEditorViewController.m:131
#1      0x0030b1ea in -[UITextField fieldEditorDidResignFirstResponder:]
#2      0x00319b61 in -[UIFieldEditor resignFirstResponder]
#3      0x0030d341 in -[UITextField resignFirstResponder]
#4      0x002f4384 in -[UITableView reloadData]
#5      0x002f189f in -[UITableView layoutSubviews]
#6      0x036c62b0 in -[CALayer layoutSublayers]
#7      0x036c606f in CALayerLayoutIfNeeded
#8      0x036c58c6 in CA::Context::commit_transaction
#9      0x036c553a in CA::Transaction::commit
#10     0x036cd838 in CA::Transaction::observer_callback
#11     0x01d49252 in __CFRunLoopDoObservers
#12     0x01d4865f in CFRunLoopRunSpecific
#13     0x01d47c48 in CFRunLoopRunInMode
#14     0x0253478d in GSEventRunModal
#15     0x02534852 in GSEventRun
#16     0x002ab003 in UIApplicationMain
#17     0x00002980 in main at main.m:14

Is there a different solution to getting a first responder in a table cell and not having it resign on 3.1?

--
Michael
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to