How do I make a uitableview in interface builder compatible with 4 inch iphone5, and the older iPhone 4/4s?
There are three options in Xcode 4.5:
- Freeform
- Retina 3.5 full screen
- Retina 4 full screen
If I chose Retina 4, then in the 3.5 inch phone it crosses/overflows the screen border
Using code, I can set the frame accordingly, but then what is the use of using interface builder?
How should one do it using Interface Builder?
EDIT
My question is for iphone 5 retina 4 inch screen. When inspecting the size of the view which has a status bar and navigation bar, here is the value of self.view.frame.size.height/width, frame 320.000000 x 416.000000 in case I choose freeform/none/retina 3.5
The autoresizing options are set so that the view expands in all directions, that is all struts and springs are enabled.
EDIT For testing in iOS6 simulator, If I set the following in code
self.tableView.frame = CGRectMake(0, 0, 320, 546);
self.tableView.bounds = CGRectMake(0, 0, 320, 546);
self.view.frame = CGRectMake(0, 0, 320, 546);
self.view.bounds = CGRectMake(0, 0, 320, 546);
NSLog(@"%2f - %2f", self.view.bounds.size.width, self.view.bounds.size.height);
NSLog(@"%2f - %2f", self.tableView.bounds.size.width, self.tableView.bounds.size.height);
I get the following output
320.000000 - 546.000000
320.000000 - 546.000000
And All the rows below the 480 px from the top are not selectable, as the 'view' still thinks they are out of bounds.
MY SOLUTION
Set the size to Retina 4 for all screens, even the main window xib file. It seems to work fine even on the iphone 4 after this. And all rows below 480px are now clickable in iOS 6 simulator