Reputation: 6386
I have tried this url to insert uitextfield in custom cell but what i am not sure is when to save the modified content.
Please let me know and thanks.
Upvotes: 0
Views: 60
Reputation: 13817
One approach is to make the your UITableViewController implement the UITextFieldDelegate protocol, then assign it as the delegate of the UITextField embedded in your CustomCell UITableViewCellSubclass.
You'll firstly need to implement the UITextFieldDelegate protocol in your table view controller subclass...
MyTableViewController : UITableViewController <UITextFieldDelegate>
Then in your subclass add an implementation for the textFieldShouldReturn:(UITextField*)textField method. This method will be called when the user finished editing the content's of your cell's UITextField...
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
NSString *enteredText = [textField text];
// .. do something with the text
}
Lastly you'll need to set your CustomCell's UITextField's delegate property to be your UITableViewController subclass. To do this simply add a single method call to your existing tableView:cellForRowAtIndexPath: method...
cell.textField.delegate = self;
Upvotes: 1