0

I have iOS app with only portrait mode enabled and one of it's ViewControllers has chart. Chart is created using PNChart library.

How can I rotate this chart so it will be in landscape orientation in Swift (iOS 7, 8, 9)?

I use this code in AppDelegate but with no luck - view is rotated but chart is not and i can see only half of it now

 func application(application: UIApplication, supportedInterfaceOrientationsForWindow window: UIWindow?) -> UIInterfaceOrientationMask {

    if self.window?.rootViewController is myChartViewController  {
            return UIInterfaceOrientationMask.Landscape
        }                
   // Else only allow the window to support portrait orientation
   else {
            return UIInterfaceOrientationMask.Portrait
        }
     }
rmaddy
  • 314,917
  • 42
  • 532
  • 579
moonvader
  • 19,761
  • 18
  • 67
  • 116
  • you need landscape orientation only for viewcontroller which shows chart ? for the rest it shouldn't rotate ? – nsinvocation Nov 11 '15 at 22:15
  • Possible duplicate of [iOS 6: How do I restrict some views to portrait and allow others to rotate?](http://stackoverflow.com/questions/12630359/ios-6-how-do-i-restrict-some-views-to-portrait-and-allow-others-to-rotate) – nsinvocation Nov 11 '15 at 22:18
  • @hal9000, yes - and i need to do it in Swift – moonvader Nov 11 '15 at 22:25

0 Answers0