iOS-键盘使用UITextfield隐藏UIAlertView

iOS-键盘使用UITextfield隐藏UIAlertView,ios,hide,uialertview,uikeyboard,Ios,Hide,Uialertview,Uikeyboard,我有一个带有UIExtField的UIAlertView。我希望用户键入一些内容并点击OK。但当键盘出现时,它会隐藏UIAlertView的按钮。当显示键盘时,是否有方法使UIAlertView移动。或者只是向上移动按钮,让用户看到按钮 这是我使用的代码: UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"title" message:@"" delegate:self cancelButtonTitle:@"Cancel

我有一个带有UIExtField的UIAlertView。我希望用户键入一些内容并点击OK。但当键盘出现时,它会隐藏UIAlertView的按钮。当显示键盘时,是否有方法使UIAlertView移动。或者只是向上移动按钮,让用户看到按钮

这是我使用的代码:

UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"title" message:@"" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Other", nil] ;
alertView.tag = 2;
alertView.alertViewStyle = UIAlertViewStylePlainTextInput;
UITextField * alertTextField = [alertView textFieldAtIndex:0];
alertTextField.keyboardType = UIKeyboardTypePhonePad;
CGRect frame = alertView.frame;
frame.origin.y = -140;
alertView.frame = frame;
alertTextField.text = @"some text";
[alertView show];

我不知道警报视图是否可以自行定位,但也许您可以将其置于滚动视图中,当用户点击文本字段时,它只会滚动到您的可见区域。

Hi。我不知道警报视图是否可以自行定位,但也许您可以将其放入滚动视图中,当用户点击文本字段时,它会为您滚动到可见区域。