I have a UIView that I wish to alter the size and position of when the view rotates. However, I need to be able to do this programmatically, not using layout settings and autosizing. To this end I have tried changing the frame and bounds of the view when the device rotates and calling for a redraw, but no matter what combination of variables I use the result always comes out wrong. I simply cannot work out what's happening to screw the code up, and there's just too much code to post here. Can someone give me any hints or methods for how this could be accomplished? I just don't know where else to look.
This is the code I use for the portrait layout which works:
clusterMap.frame = CGRectMake(0, self.view.frame.size.height/2,
self.view.frame.size.width,
self.view.frame.size.height/2);
clusterMap.bounds = CGRectMake(-clusterMap.frame.size.width/2,
-clusterMap.frame.size.height/2,
clusterMap.frame.size.width,
clusterMap.frame.size.height);
[clusterMap setNeedsDisplay];
But when I try to use an adapted version of this code with different figures, it just displays as if the screen were portrait. If I switch the figures around so that some are portrait and some are landscape, all kinds of weird things happen. One example that I can describe is that the image might draw in the proper proportions, but be clipped to the incorrect proportion's boundary. I've tried every combination of figures I can think of, systematically swapping width and height between paired values one at a time, and none of these combinations work.