UIAlertView
消息在编辑其中的文本字段时(显示键盘时)无法正确显示。它是这样的:
当键盘不存在时:
这是创建警报 View 的代码:
UIAlertView *alertView = [[UIAlertView alloc]
initWithTitle:@"Title"
message:@"Enter a name for your recipe"
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"OK", nil];
[alertView setAlertViewStyle:UIAlertViewStylePlainTextInput];
[alertView show];
有没有办法改变 View 的某些组件的大小,以便在显示键盘时它能正确地适合屏幕?
编辑:我刚刚发现当键盘出现时警报 View 变得可滚动。因此,如果向下滚动,您可以看到该消息。但是我没有注意到第一次弹出警报 View ,其他用户可能也没有。现在,我正在使用 Visput 建议的内容。
最佳答案
这是 iOS 的标准行为。在横向模式下创建新相册时,您可以在“照片”应用程序中看到相同的布局。
我认为在这种情况下最好的方法是:将所有文本放置到 message
但 title
设置为 nil。
在你的情况下:
UIAlertView *alertView = [[UIAlertView alloc]
initWithTitle:nil
message:@"Title: Enter a name for your recipe"
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"OK", nil];
关于ios - 显示键盘时 UIAlertView 消息未正确显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23194096/