My application is composed of a toolbar and an AVCaptureVideoPreviewLayer in a background UIView. I\'d like to see that toolbar rotate regarding the device orientation, so in my
I finally found a sane answer for this. No more messing around with "anti-rotation animations" and such!
The key is to use a UIViewController for your preview layer (the non-rotating view) and another for the actual interface. Configure the rotation options for both using shouldAutorotateToInterfaceOrientation: (the code is in the answers above):
The important bit is to keep your views separate by adding them directly to the window. I do this in the AppDelegate:
[self.window addSubview:previewViewController.view];
[self.window addSubview:interfaceViewController.view];
self.window.rootViewController = interfaceViewController;
[self.window makeKeyAndVisible];
That puts your video preview in the background, and then adds the interface view over it. The interface is free to autorotate without affecting the preview at all.
One important thing to note: the background of your interface view should be transparent, otherwise it blocks the preview.