Question

I am working on an iOS app with a small table view in portrait mode. And I want this view to become something totally different in landscape mode. I haven't coded it yet, but something like http://www.vertex42.com/ExcelArticles/Images/timeline/Timeline-for-Benjamin-Franklin.gif (It will be in a scroll view)

I've already read things like that: " Trying to load new view upon orientation change " but as my portrait view is a UITableView I don't know how to set the portrait view...

I'm working with a UITableViewController subclass which is initiated by the AppDelegate.

Thanks for your answer and sorry for my poor English...

EDIT : The solution : You have to create a custom UIViewController with two views which will be the tableView's delegate and data source. Then in - (BOOL)shouldAutorateTo.... You set the "hidden" property to do what you want.

/!\ Don't forget to initiate your tableView property and set its delegate and data source properties

Was it helpful?

Solution

If you want more flexibility, take out the UITableViewController and put a UIViewController with a UITableView inside. As for the rotations, I would probably switch the UITableView for a UIScrollView on the moment of the rotation.

OTHER TIPS

You can add an scrollview as a child of your self.view, then in your ViewController you could do this

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
    if (UIDeviceOrientationIsLandscape(toInterfaceOrientation)) {
        tableView.hidden = YES;
        scrollView.hidden = NO;
    }
    else {
        tableView.hidden = NO;
        scrollView.hidden = YES;
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top