I am currently working on supporting multi orientations of the iPhone (iPad) Screen, where on rotation some objects will be resized and others will be moved. For example I am wanting to move a tableView object and I want to ensure when I rotate back to Portrait that the tableview ends up in the exact same place before I moved it.
I came up with some quick debug code you can use in your iPhone App Development (or iPad App development).
The idea is you get the H,W,X,Y co-ordinates and can then later perfectly replace the initial properties.
Run this in viewDidAppear (for example)
int height = tableView.frame.size.height;
int width = tableView.frame.size.width;
int x = tableView.frame.origin.x;
int y = tableView.frame.origin.y;
NSLog(@”TableView Height:%d”,height);
NSLog(@”TableViewWidth:%d”,width);
NSLog(@”TableViewX:%d”,x);
NSLog(@”TableViewY:%d”,y);
Then later in willRotateToInterfaceOrientation you can use the code:
tableView.frame = CGRectMake(x, y, w, h); //where x,y are the frame origin coordinates (x,y) and w,h are the width and height of the frame
