I have a class that extends UITextfield. I also have the same class set to be it's own delegate so when the text field is selected I can change the background color. Once I selecte the text field and type a couple of letters the app locks up and crashes.
here is what my .m file looks like
@implementation MyTextField
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self)
{
self.delegate = self;
}
return self;
}
- (void)textFieldDidBeginEditing:(UITextField *)textField
{
NSLog(@"run did begine editing");
[self setBackgroundColor:[UIColor colorWithRed:0.204 green:0.239 blue:0.275 alpha:0.25]];
}
- (void)textFieldDidEndEditing:(UITextField *)textField
{
NSLog(@"run did end editing");
[self setBackgroundColor:[UIColor clearColor]];
}
here is the .h
@interface MyTextField : UITextField <UITextFieldDelegate>
@end