Reputation: 625
I have a view controller with a table view. The UITableViewCell width is set to 320 in IB. Now, I want to use the view controller in iPad by adding it to a superview. The superview's width is bigger than 320. The table view shows on the superview. The problem is that it only occupy 320. How can I change the cell width to occupy whole superview's width? Thanks.
Upvotes: 0
Views: 863
Reputation: 1347
Hey you need to create a custom UITableViewCell. Than you can overwrite the function
- (void) layoutSubviews
{
[dateLabel setFrame:CGRectMake(10.f, 16.f, 80.f, 12.f)];
[textLabel setFrame:CGRectMake(106.f, 16.f, self.frame.size.width-105.f + 1.f, 12.f)];
}
In that function the self.frame.size.width
is the actual one.
And it works with rotation of the device, too.
Upvotes: 0