iOS 6 UITabBarController supported orientation with current UINavigation controller

Subclass your UITabBarController overriding these methods: -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // You do not need this method if you are not supporting earlier iOS Versions return [self.selectedViewController shouldAutorotateToInterfaceOrientation:interfaceOrientation]; } -(NSUInteger)supportedInterfaceOrientations { return [self.selectedViewController supportedInterfaceOrientations]; } -(BOOL)shouldAutorotate { return YES; } Subclass your UINavigationController overriding these methods: -(NSUInteger)supportedInterfaceOrientations { return [self.topViewController supportedInterfaceOrientations]; } -(BOOL)shouldAutorotate { return YES; } … Read more

Rotating a view in layoutSubviews

The problem with the code in the question seems to be that the transformations keep getting added to each other. In order to fix this, the solution is to reset the transformations every time, that is, set it to the identity transform. rotationView.transform = CGAffineTransformIdentity Here is a partial implementation that shows the key parts. … Read more

UITabBarController Rotation Issues in ios 6

Zack, I ran into this same issue. It’s because you have your viewController embedded inside of a TabBar Controller or UINavigationController and the calls to these methods are happening inside those instead of your normal View (Changed in iOS6). I ran into this issue because I was presenting a viewController embedded inside a UINavigationController on … Read more

Python Array Rotation

You can rotate a list in place in Python by using a deque: >>> from collections import deque >>> d=deque([1,2,3,4,5]) >>> d deque([1, 2, 3, 4, 5]) >>> d.rotate(2) >>> d deque([4, 5, 1, 2, 3]) >>> d.rotate(-2) >>> d deque([1, 2, 3, 4, 5]) Or with list slices: >>> li=[1,2,3,4,5] >>> li[2:]+li[:2] [3, 4, … Read more

Rotation only in one ViewController

I’d recommend using supportedInterfaceOrientationsForWindow in your appDelegate to allow rotation only in that specific view controller, ex: Swift 4/Swift 5 func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask { // Make sure the root controller has been set // (won’t initially be set when the app is launched) if let navigationController = window?.rootViewController as? … Read more