【问题标题】:UiTextView String Trim after Device Orientation设备方向后UiTextView字符串修剪
【发布时间】:2017-03-14 16:35:12
【问题描述】:

我正在创建一个 iPad 应用程序。当我更改设备方向时,进入横向模式并再次纵向模式后,UiTextView 中的值未正确显示。

image of landscape mode

image of portrait mode again

【问题讨论】:

    标签: uitextview uideviceorientation


    【解决方案1】:

    调用下面的函数。它在更改设备方向时调用。

    override func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) {
        if UIDevice.currentDevice().orientation.isLandscape.boolValue {
            dispatch_async(dispatch_get_main_queue(), { // code for reload data })
        } 
        else {
            dispatch_async(dispatch_get_main_queue(), { // code for reload data })
        }}
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-06
      • 2015-02-16
      • 1970-01-01
      • 2011-04-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多