I just started reading up on Objective-C yesterday, and i can’t quite figure why my
textFieldShouldReturn
method isn’t being run.
This is the actual method:
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
self.itemTxt.text = @"Return pressed";
return YES;
}
This is the interface line in my header file:
@interface ArrViewController : UIViewController <UITextFieldDelegate>
You need to actively set the delegate for the
UITextField:For example, in
viewDidLoadyou could write:You can also hook this up in Interface Builder if desired.