1

I have a custom UITableViewCell with a UITextField and a method that is being called when the user changes the text in the textField. How do I change the title of the ViewController when the text in the textField is changed?

icant
  • 878
  • 4
  • 10
  • 28

1 Answers1

2

You have to create an outlet for your textField and then you can just set your ViewControllers title property to be your textField's text. Something like the following should do the trick:

[self.delegate.title=textField.text];
Julian
  • 1,573
  • 2
  • 22
  • 36
  • Where do I have to paste that code? In the ViewController viewDidLoad method or in the UITableViewCell textFieldDidChange method? – icant Apr 17 '11 at 12:28
  • You can send this message from within your UITableViewCell's textFieldDidChange method (if you have set your Cell's delegate correctly) – Julian Apr 17 '11 at 12:31
  • I haven't set my delegate, how do I do that? – icant Apr 17 '11 at 17:56
  • Have a look at this great answer: http://stackoverflow.com/questions/626898/how-do-i-create-delegates-in-objective-c/626946#626946 After you've set up your delegate property you can set your ViewController as your UITableViewCell's delegate in the cellForRowAtIndexPath: method (cell.delegate=self;) – Julian Apr 25 '11 at 00:05