【问题标题】:UIAlertView has scrollable title and message on iOS7UIAlertView 在 iOS7 上有可滚动的标题和消息
【发布时间】:2013-10-30 07:08:57
【问题描述】:

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

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

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 上的结果是这样的:

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

如何解决此问题?

编辑:

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

【问题讨论】:

  • 你不能。随意提高对它的雷达(但不要坚持改变)。
  • 我遇到了完全相同的问题...

标签: ios ios7 uialertview


【解决方案1】:

我使用了自定义控件URBAlertView。我发现了一个类似的问题,我已经在github here 上向作者报告了这个问题。

作者在提交 here 下提供了修复。但是,您也可以参考 repo here 上的前三个提交。

希望能帮助大家找到解决办法

【讨论】:

    【解决方案2】:

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

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

    我希望这会有所帮助!

    【讨论】:

    • 我不够清楚抱歉。如果没有显示警报的空间,这确实是一种很好的行为。我用向下滚动的相同警报的屏幕截图更新了我的帖子。如您所见,完整的消息可见。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-14
    • 2013-12-18
    相关资源
    最近更新 更多