martinjbaker
martinjbaker

Reputation: 1484

Why is cell bounds and frame size incorrect when UITableView is in UIPopoverController?

I have a UIViewController subclass with XIB which is 320 wide and 400 high. The XIB has a UITableView which fills the width and height of the view.

In the viewDidLoad method of the VC, I have the following

self.contentSizeForViewInPopover = CGSizeMake(600.0, 400.0);

The tableview is displaying correctly in the popover. All good so far.

Now I'm programatically adding a UIProgressView to the tableview cells but there's something I don't understand. In the cellForRowAtIndexPath method, I wanted to set the width of the UIProgressView in relation to the cell's width, yet the cell.frame.size.width and cell.bounds.size.width are the original 320 and not the actual 600 as displayed.

I can workaround it by using the tableview's width value but I'm confused why the values aren't correct at the cell level.

Upvotes: 2

Views: 626

Answers (1)

martinjbaker
martinjbaker

Reputation: 1484

It seems that the size values are as expected in

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath

So I'm guessing between cellForRowAtIndexPath and willDisplayCell is where the resizing to popover happens.

Upvotes: 2

Related Questions