how to neatly re-arrange button display on willAnimateRorationToInterfaceOrientation
I'm teaching myself more iOS by duplicating Apple's calculator app. I've gotten the whole portrait mode working.
Now I want to copy the feature where it resizes the existing buttons, moves them off to the right side, and adds a whole bunch of additional buttons and functionality when the user rotates to landscape.
What I've seen in the docs and online so far has a lot of hardwiring, where I have to write code that manually moves each button to a specific location. I would prefer to go by a ratio of the screen size to support different screens.
开发者_开发问答So I'd have to resize the buttons and their text, show/hide a set of extra buttons, change the UILabel, show/hide a couple extra UILabels, etc.
can i just have a different xib file with the altered version that it will animate to? or do i have to program the whole thing manually?
what would be the best approach here?
What I would do is place those buttons within another UIView then rotate the UIView to the new location. That way it handles all the scaling and positions and will all maintain there position relatively.
精彩评论