希望这将是一个简单的修复!
我正在使用 .m 文件中的以下代码将 UITextField 添加到我的应用程序:
editTextField = [[UITextField alloc] init];
editTextField.frame = CGRectMake(0, [self getTopOfTabBar] - 30, practiceScreenWidth, 30);
editTextField.delegate = self;
editTextField.backgroundColor = [UIColor blueColor];
[self.view addSubview:editTextField];
但是,每当我单击此 UITextField 时,应用程序就会卡住。日志中没有错误或错误,应用程序只是停止响应。
关于一些额外的信息,这里是 .h 文件中的接口(interface)
@interface PracticeViewController : UIViewController <UITextFieldDelegate>
感谢任何帮助!
最佳答案
这似乎是 Xcode 11 问题:
完全退出模拟器并重新运行应用程序。如果这不起作用,有些人已通过尝试以下解决方法取得了成功:
Simulator -> Edit -> Automatically Sync Pasteboard
这也发生在我身上,但只有在模拟器中,当我在设备上构建时,文本字段才能正常工作。
关于ios - 单击 UITextField 后应用程序卡住,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58355007/