How to avoid the resize of the UITableView (rotated) cells after the orientation change?

ios, ipad, rotation, uitableview

Solution

Ok, the problem was that since the width of the tableview was flexible, after the rotation the width of the cells (which is actual the height) were increased too. I overcame the problem by subclassing the UITableView and overriding the layoutSubviews method, so it looks like this now:

- (void)layoutSubviews {

    [super layoutSubviews];

    for (UIView* child in [self subviews]) {

        CGRect frame1 = child.frame;
        if ([child isKindOfClass:[UITableViewCell class]]) {
            frame1.size.width = 120;
            child.frame = frame1;        
        } 
    }

}

Anyway, I still don't understand why the uitableview was resizing its cells if I explicitly set the Autoresize Subviews to false.

Problem

I am implementing the horizontal UITableView by rotating it by 90 degrees ``` horizontalShopsTableViewController.view.transform = CGAffineTransformMakeRotation(-M_PI/2); ``` and then rotating its cells back by 90 degrees: ``` cell.contentView.transform = CGAffineTransformMakeRotation(M_PI/2); ``` I want the table to have the flexible width. If I do not set it to be flexible, everything works fine after the orientation change. However if I do, the contents of the cells are misplaced and disappear. The flag "Autoresize Subviews" of the table view is false. Any ideas what could be the causing problem or what alternatives could be used?

Original source