OGeek|极客世界-中国程序员成长平台

标题: ios - UIAlertView 在 iOS7 上有可滚动的标题和消息 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 15:52
标题: ios - UIAlertView 在 iOS7 上有可滚动的标题和消息

我有一个带有文本的 UIAlertView,它可以毫无问题地显示在 iOS6 上。 但是在 iOS7 中,此警报的标题和消息位于 ScrollView 中。

我正在使用以下代码创建警报

self.newCategoryAlertView = [[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"MessageTitleNewCategory", nil)
                                                            message:NSLocalizedString(@"MessageTextNewCategory", nil)
                                                           delegate:self
                                                  cancelButtonTitle:NSLocalizedString(@"ButtonCancel", nil)
                                                  otherButtonTitles:NSLocalizedString(@"ButtonOK", nil), nil] autorelease];

self.newCategoryAlertView.tag = alertViewTypeNewCategory;
self.newCategoryAlertView.alertViewStyle = UIAlertViewStylePlainTextInput;
[self.newCategoryAlertView textFieldAtIndex:0].delegate = self;
[self.newCategoryAlertView textFieldAtIndex:0].autocapitalizationType = UITextAutocapitalizationTypeSentences;
[[self.newCategoryAlertView textFieldAtIndex:0] setReturnKeyType:UIReturnKeyDone];
[[self.newCategoryAlertView textFieldAtIndex:0] setKeyboardAppearance:UIKeyboardAppearanceDefault];
[self.newCategoryAlertView textFieldAtIndex:0].enablesReturnKeyAutomatically = YES;

[self.newCategoryAlertView show];

iOS7 上的结果是:the result on iOS7

我试图使文本更短但没有成功,并且 UIAlertView 的文档没有给我提示。

如何解决此问题?

编辑:

这是向下滚动时的外观。如您所见,完整的消息可见。

same alert scrolled down



Best Answer-推荐答案


在我看来,这是一个很好的行为,因为屏幕上没有空间来显示键盘和 de UIAlert。我几乎可以肯定,如果您让应用程序以纵向运行,警报将显示正常,没有可滚动的标题和消息。

如果应用只在横向运行,并且您不希望有一个可滚动的 View ,我想最好的解决方案可能是保留 UIAlert 消息,但取消 UIAlert 倾斜。

我希望这会有所帮助!

关于ios - UIAlertView 在 iOS7 上有可滚动的标题和消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19500496/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4