每当我在设备上的子类UITextfield中输入文本时,我会输入两到三个字符然后应用程序冻结。无法关闭键盘或触摸任何标签。这是UITextField子类:
@implementation OAI_TextField
@synthesize elementID;
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
colorManager = [[OAI_ColorManager alloc] init];
fileManager = [[OAI_FileManager alloc] init];
self.font = [UIFont fontWithName:@"Helvetica" size:20.0];
self.textColor = [colorManager setColor:66.0 :66.0 :66.0];
self.borderStyle = UITextBorderStyleRoundedRect;
self.backgroundColor = [UIColor whiteColor];
self.returnKeyType = UIReturnKeyDone;
self.delegate = self;
}
return self;
}
#pragma mark Text Field Delegate Methods
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
[self resignFirstResponder];
//if project number text field we're going to check and see if the "Project" directory contains the file, if not we'll create it
//get super view
UIView* myParent = self.superview;
//get the subviews
NSArray* mySiblings = myParent.subviews;
//get the label
UILabel* myLabel = [mySiblings objectAtIndex:0];
//get the label text
NSString* myLabelText = myLabel.text;
//check it!
if ([myLabelText isEqualToString:@"Project Number:"]) {
NSString* projectNumberPlist = [NSString stringWithFormat:@"%@.plist", self.text];
NSString* projectNumberPlistPath = [NSString stringWithFormat:@"Projects/%@", projectNumberPlist];
[fileManager createFile:projectNumberPlist:projectNumberPlistPath];
}
return YES;
}
- (void)textFieldDidBeginEditing:(UITextField *)textField {
NSLog(@"ok");
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
// Drawing code
}
*/
@end
我将获得NSLog调用 - (void)textFieldDidBeginEditing:。我在控制台中没有收到任何错误消息。不确定从哪里开始调试这个。有人能给我一个轻推吗?
由于