在横向模式下,如何强制UIAlertView显示完整的消息而不滚动?

时间:2013-11-22 22:35:04

标签: ios objective-c uiscrollview ios7 uialertview

我有一个应用程序,提示用户使用UIAlertView输入。应用程序被锁定在横向模式中,因此UIAlertView的大小增长空间有限。在iOS 5和6中,我创建的两个UIAlertViews能够显示其标题和消息,而无需强制用户在UIAlertView内滚动以查看完整消息。

1st Alert in iOS 6. Notice that no scrolling is required.

2nd Alert in iOS 6. Notice that no scrolling is required.

但是,在iOS 7中,完全相同的警报(意味着文本保持不变),用户必须滚动才能显示完整的消息。以下是iOS 7中显示的警报:

1st Alert in iOS 7. Notice that the full message is not displayed.

2nd Alert in iOS 7. Notice that the full message is not displayed.

有趣的是,有足够的空间在至少第一个警报中显示完整的消息。下面是滚动一点后的第一个警报的图像。

1st Alert in iOS 7. This screenshot shows that the full message does fit in the alert view.

在第二个警报视图中,即使在滚动之后整个消息也不适合,因为消息占用了两行。但是,在iOS 6中,消息只占用了一行。

2nd Alert in iOS 7. This screenshot shows that the full message does not fit in the alert view, even after the user scrolls.

我的问题是:

  1. 如果是第二个警报,为什么消息会在iOS 7中的两行显示,我该如何防止这种情况发生?
  2. 在横向模式下,如何强制UIAlertView显示完整信息而不滚动?
  3. 为什么UIAlertView的行为会在iOS 7中发生变化?

1 个答案:

答案 0 :(得分:3)

  1. 它显示在2行上,因为新的iOS7样式不适合。增加了填充,即使没有填充,新的iOS 7动态类型套件字体大小也会阻止您进行任何尺寸保证。
  2. 你不能,不能没有制作自己的自定义UIView,使它看起来相似,但减少填充和锁定字体大小。
  3. 整个操作系统的风格发生了变化。虽然我很惊讶他们增加了填充量。我想,对于动态字体大小,他们并不太担心保持向后兼容的布局。