0

I want to delay the auto rotation in ios.

When I rotate the device to landscape my view's just stay as it is for 3 sec and then view's rotate to landscape.

Is it possible to achieve.

Please help.

Thanks.

Pradumna Patil
  • 2,180
  • 3
  • 17
  • 46
  • 1
    it is possible to achieve yes, you can handle the orientation changes manually – but I guarantee for you, you would have more new problems with that than you actually resolve in a bigger app, so I would not recommend it to do so – however it is easy procedure in case of 1-2 views only with a few controls on the screen for a demo project. – holex Jan 25 '16 at 10:52
  • @Popeye "As of iOS 8, all rotation-related methods are deprecated," from UIViewController Class Reference docs. – Jeff Jan 25 '16 at 12:53

1 Answers1

0

Try to use this:

    let delayTime = dispatch_time(DISPATCH_TIME_NOW, Int64(3 * Double(NSEC_PER_SEC)))
    dispatch_after(delayTime, dispatch_get_main_queue()) {
       let value = UIInterfaceOrientation.LandscapeLeft.rawValue
       UIDevice.currentDevice().setValue(value, forKey: "orientation")
    }
iAnurag
  • 9,286
  • 3
  • 31
  • 48