Reputation: 3301
I have added UITableView to a view, I want my application to work fine for both iPod 5th generation and lower versions(which is smaller in size), So I resized the table view height to its view height when loading, its not working, however if I resize the table in xib its working fine. What could be the problem. I suspect some property is restricting from doing this.
Please check the image below.
Black gap appears because of its size... Its not resizing..
I have set programatically also...
if (gui_status.device_type != OFI_VC_DVICE_TYPE_IPAD) {
CGRect screenRect = self.table.frame;
screenRect.size.height = 500; // with different height no change..
[self.table setFrame:screenRect];
}
Upvotes: 1
Views: 4244
Reputation: 2145
Use AutoLayout to manage the height for UITableView and other subviews automatically whenever the screen size get changed
Upvotes: 0
Reputation: 921
self.view.autoresizesSubviews = UIViewAutoresizingFlexibleHeight; //self.view will be the superview of tableView
Try this.
Upvotes: 0
Reputation: 119041
Rather than setting the size explicitly, when you lay out the view in the XIB, set the auto-resizing rules so that the table view has flexible width and height and static top, bottom, left and right. Now, when iOS resizes the super view (done automatically) your table view will automatically be adjusted to fit.
Upvotes: 4