I'm having some real issues understanding why center on my views behave like it does, totally discarding orientation of the device (and my otherwise good google-skills give nothing)... I understand how frame, bounds and center relate to one another/superviews etc. (here is a good explaination).
So, I have a few ViewControllers (call them A & B). B is presented "modally" by A, using a "Cover Vertical"-transition (really not that relevant, but who knows...).
Now, running the following code
self.view.center = CGPointMake(self.view.frame.size.width * 0.5f, self.view.frame.size.height * 0.5f + 100);
inside any of the viewcontrollers (triggered by a button-press), will move the view in the wrong direction for all orientations except portrait (portrait "up"). Basically Portrait will move the view down 100px (Yes!), Landscape will move either left or right 100px, and Upside Down will move up 100px. Looking at the device in hand it will move the view by 100px from the same physical side for each orientation (for a visual reference).
Am I missing something very obvious here, using some weird settings or is this just the expected behaviour? (I hope it's the first or second one).
In my mind, x is always horizontally and y is always vertically for all orientations, and that this is managed at a lower level (by the OS).
So, please point out the obvious and have a good laugh at my expense! :)
Edit.
Okey, so I started an empty project (with a single view), and the behaviour was the same. But then I dragged in a Navigation Controller in IB, setting the main-controller (A) as root. Simsalabim and yes it behaves as I want it to... Ofc I can remove the navigation-bar and it looks the same. I know the "window" and root-viewcontroller work together to setup orientation (viewcontroller determining if it's allowed etc.), but is this the way to go? Why doesn't it work with a single ViewController? Or do you just expect UIView.center to behave this "oddly" if your initial ViewController is just a plain "View Controller"? Or do you always have a navigationController as the initial point? Brain... Hurts...
Edit 2.
Okay, so there seems to be ZERO consistency on when the frame/bounds is returning what. Basically, if you have a simple ViewController as the initial controller (e.g. not embedded as root-viewcontroller in a NavigationController), the orientation will be wrong. It will be visually correct, but frame ignores orientation and bounds seem to be correct most of the time. When would you ever want the frame to ignore the actual orientation (how the view/gui is rendered)?! Of course I want it to be like I see it on the device! This makes custom segues a awful pain, since, say, a sliding animation won't look the same in landscape and portrait... I've seen multiple examples in blogs etc. "explaining" how it works, but none actually work in both orientations... Do people just accept this nonesense or is it just me actually seeing the issue with it? I've googled like a maniac and NO ONE has had a working example, all just hacking and slashing til it "seem to work"...
^Rage :)