ios - 具有滚动功能的大量文本的 UIAlertController?

标签 ios iphone swift ios8

UIAlertController 显示小字符串。当字符串的大小变大时。那么此警报中的一些文本丢失了。是否有任何滚动功能可以滚动到剩余的文本?

var alert = UIAlertController(title: "title here", message: "about 30 line text here", preferredStyle: UIAlertControllerStyle.Alert)
    alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: nil))
    self.presentViewController(alert, animated: true, completion: nil)

如何发出提醒,显示大于 30 行的文本。我用的是 swift。

最佳答案

它在 Playgrounds 中毫不费力地工作:

import UIKit
import PlaygroundSupport

PlaygroundPage.current.needsIndefiniteExecution = true
let window = UIWindow()
let viewController = UIViewController()
window.rootViewController = viewController
window.makeKeyAndVisible()

let message = (1...1000).reduce("") { $0 + "\($1)\n" }

let alert = UIAlertController(title: "title here", message: message, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "action here", style: .default, handler: nil))
viewController.present(alert, animated: true, completion: nil)
PlaygroundPage.current.liveView = window

我有 1000 条可滚动行:

1000 scrollable lines

关于ios - 具有滚动功能的大量文本的 UIAlertController?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27032471/

相关文章:

ios - 如何通过在SwiftUI中触摸屏幕的任何位置来更改文本

ios - iOS 会自动清理钥匙串(keychain)项目吗?

ios - 如何传递对 UIView 实例的引用

iphone - OpenGL ES 未按预期工作

iphone - 从 NSDictionary 中检索值

ios - UIAlertAction 中空文本字段的摇动动画

ios - 在模拟器上运行,同时拥有不在模拟器上显示类的 SDK(阻止我运行)

ios - 使用 UIView.Animate 将后退按钮移至原始位置

swift - 与功能和属性相关的性能影响

ios - Storyboard减少 View 之间的差距