Looks like I'm having a problem with UITextFieldDelegate.
I just created a view controller that responds to the protocol UITextFieldDelegate, and easily added the field to xib, and then set the delegate field ... you know.
But when I try to click on the field (to start editing, the program crashes).
The same thing happens when I try to create a field programmatically.
Here is the call stack:

Here is the complete code:
.h
#import <UIKit/UIKit.h>
@interface TopBar : UIViewController <UITextFieldDelegate>
{
IBOutlet UITextField * field_top;
}
wow
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
NSLog(@"textFieldShouldBeginEditing");
textField.backgroundColor = [UIColor colorWithRed:220.0f/255.0f green:220.0f/255.0f blue:220.0f/255.0f alpha:1.0f];
return YES;
}
- (void)textFieldDidBeginEditing:(UITextField *)textField
{
NSLog(@"textFieldDidBeginEditing");
}
- (BOOL)textFieldShouldEndEditing:(UITextField *)textField
{
NSLog(@"textFieldShouldEndEditing");
textField.backgroundColor = [UIColor whiteColor];
return YES;
}
- (void)textFieldDidEndEditing:(UITextField *)textField
{
NSLog(@"textFieldDidEndEditing");
}
Delegation is set by IB.
Screenshot with error:

Any help please.
source
share