Bad screen orientation with multiple viewcontrollers / views in iOS 7, landscape only (iOS 8 is ok)

I am using TheSidebarController to implement adding a sliding menu to an iOS app. This is the library I am using, but I found the same problem in other libraries like ECSlidingViewController etc. They essentially work by adding multiple view controllers to the containing view controller, nothing crazy.

The problem is that when you make an app a landscape app, all of the screens in the container - menu, content screen - seem to think they are in portrait mode and are cut in half. You can see the problem in this screenshot where the table is disabled: http://imgur.com/xD5MUei

I am trying to get this to work in any way and I have no luck.
The library I'm using + a sample project can be found here: https://github.com/jondanao/TheSidebarController

Any help is appreciated :)

EDIT: People say that I can stretch the table to make it look ok, but that just masks the underlying problem, which is the app and / or screens still believe they are in portrait orientation. As a quick example, if I take the example project and in the LeftViewController replace the following code:

- (void)dismissThisViewController
{
  UIViewController* vc = [[UIViewController alloc] init];
  UINavigationController* pulldown = [[UINavigationController alloc] initWithRootViewController:vc];

  pulldown.view.frame = CGRectMake(pulldown.view.frame.origin.x, -[[UIApplication sharedApplication] delegate].window.frame.size.height,
                                   pulldown.view.frame.size.width, pulldown.view.frame.size.height);
  [[[UIApplication sharedApplication] delegate].window addSubview:pulldown.view];

  [UIView animateWithDuration:.5 animations:^{
    pulldown.view.frame = CGRectMake(pulldown.view.frame.origin.x, 0,
                                     pulldown.view.frame.size.width, pulldown.view.frame.size.height);
  } completion:^(BOOL finished) {
    ;
  }];
}

      

The view controller is on the side, not on top.

+3


source to share


4 answers


It was weird ... I had to set the content controller frame, which made sense, but then I had to reset it every time the content was updated:



- (void)setContentViewController:(UIViewController *)contentViewController
{
    // Old View Controller
    UIViewController *oldViewController = self.contentViewController;
    [oldViewController willMoveToParentViewController:nil];
    [oldViewController.view removeFromSuperview];
    [oldViewController removeFromParentViewController];

    // New View Controller
    UIViewController *newViewController = contentViewController;
    [self.contentContainerViewController addChildViewController:newViewController];
    [self.contentContainerViewController.view addSubview:newViewController.view];
    [newViewController didMoveToParentViewController:self.contentContainerViewController];

    _contentViewController = newViewController;
    if ([DeviceDetection isDeviceiPad]) {
      _contentViewController.view.frame = CGRectMake(0, 0, 1024, 768);
    }
}

      

+2


source


Have you checked if this is related to the new orientation of the interface?



https://developer.apple.com/library/ios/releasenotes/General/WhatsNewIniOS/Articles/iOS8.html chapter -> Support for new screen sizes and weights

0


source


In CenterViewController.h, the class will be subclassed instead UITableViewController

.

Then comment out [self.view addSubview:self.tableView];

in CenterViewController.m.

Done!

0


source


As centerViewController.m

you create a table view, add this line:

self.tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth;

      

0


source







All Articles