tags:

views:

249

answers:

2

I have a UITableView full of custom draw cells. When the view rotates, it just stretches all my custom drawing. How can I get my views to redraw themselves when the view rotates?

A: 

My solution was to override like willAnimateRotationToInterfaceOrientation:duration: so:

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration
{
    [self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationFade];
}

Of coarse, this only works in 3.0 and you would need to reload all of your sections if you had more than one.

David Beck
+1  A: 

Set your views' contentMode to UIViewContentModeRedraw.

KennyTM