uitextviewuideviceorientation

UiTextView String Trim after Device Orientation


i am creating an iPad app. When i changing the device orientation, after go to Landscape mode and again Portraint mode the value inside UiTextView not showing correctly.

image of landscape mode

image of portrait mode again


Solution

  • call the below function. It invoke when changing the device orientation.

    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 })
        }}