我创建了一个全新的基于视图的项目并添加到viewDidLoad中
- (void)viewDidLoad
{
[super viewDidLoad];
myField = [[UITextField alloc] initWithFrame:CGRectMake(50, 50, 150, 31)];
myField.delegate=self;
[self.view addSubview:myField];
[myField release];
}
Run Code Online (Sandbox Code Playgroud)
我的头文件是
@interface textfieldpracticeViewController : UIViewController<UITextFieldDelegate>{
UITextField *myField;
}
Run Code Online (Sandbox Code Playgroud)
当我点击文本字段并弹出键盘时,我开始输入但是在第二个字符上,我得到了exc_bad_access错误.我使用NSZombieEnabled,NSDebugEnabled,MallocStackLoggin和MallocStackNoCompact运行它,但它们无法捕获错误.
这在使用iphone 4.3模拟器时失败,但是当我在iphone上构建它时工作正常.这是一个xcode错误还是我错过了什么?
谢谢
PS甚至尝试过财产/合成废除