【发布时间】:2015-04-22 22:04:28
【问题描述】:
我有一个在其登录窗口中正常使用 UIAlertView 的应用程序:
self.customAlert = [[IFCustomAlertView alloc] initWithTitle:@"Save Password"
message:@"¿Do you want the app to remember your password?"
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:@"Cancel", nil];
问题是......因为我将我的设备更新到 iOS8,每当这个 alertView 出现时,它就会显示键盘,我无法关闭它。在 iOS7 上不会发生这种情况。
点击发送按钮时,我将退出用户和密码的响应者:
-(IBAction)btnSendTapped:(id)sender{
[self.tfpass resignFirstResponder];
[self.tfuser resignFirstResponder];
}
我试过了:
[self.view endEditing:YES];
在某些 alertViews 中它确实有效,但在另一些中则无效。我的 AlertViews 从来没有文本字段,所以我认为这个键盘没有理由出现。
键盘上的介绍按钮也不会隐藏它,所以有时确定和取消按钮被键盘挡住了,我在屏幕上什么也做不了。
我认为这可能与 UIAlertView 弃用有关,但我不知道。
我也实现了这些方法:
- (BOOL)textFieldShouldReturn:(UITextField *)textField{
[textField resignFirstResponder];
return true;
}
-(BOOL)textFieldShouldEndEditing:(UITextField *)textField{
return YES;
}
任何帮助将不胜感激。
【问题讨论】:
-
我看到您使用的是
IFCustomAlertView。尝试检查您的IFCustomAlertView与默认UIAlertView有何不同 -
它只是有一些设计定义,具体取决于我显示的 UIAlertView 的类型,但不会影响代码。奇怪的是它只是在 iOS8 上发生
标签: ios objective-c keyboard uialertview uialertcontroller