Cannot Show Modal Viewcontroller in iOS7

Cannot show modal ViewController in iOS7

Turns out the issue only shows up when customizing UIBarButtons. If we use the following in our 32-bit app running on iPhone 5s, we have the problem:

[[UIBarButtonItem appearance] setTitlePositionAdjustment:UIOffsetMake(0, 1.0)
forBarMetrics:UIBarMetricsDefault];

Leaving out that line works around the problem. We have filed a radar.

iOS 7 - Getting warning message while presenting modal view controller

A view controller is detached if the story board is not aware of any segues that connect that view controller in any way back to the root view controller.

It's suggested that you create a segue via Interface Builder and call it in code, even for a modal view, if you are using a storyboard.

Even with XCode 4.6.x and iOS 6.x, you got warnings at build time about unattached view controllers.

If you have two storyboards (one for iPhone and one for iPad), you can name the segue the same for each. Segue identifiers only have to be unique per storyboard. So, performing a segue (performSegueWithIdentifier) with the same identifier can take you to one place on the iPhone and another on the iPad.

iPad/iOS7: 'Page' modal view controller strange behaviour after presenting 'Full screen' view controller from it

There is no good solution, it's an Apple bug, and until it is fixed, you have to work around it. It has not been fixed in iOS 7.1. I worked on a solution to this and realized I was implementing the same solution as well. It's ugly, but it works.

A word on this design. My guess why Apple overlooked this problem is because presenting a view controller in fullscreen is not something Apple would do. This is not an excuse of course, and sometimes there is no other option but to present fullscreen (we had to open a camera view, which must be opened in fullscreen, for example). Perhaps you can change your design to accommodate Apple's bugs.

Modal View controller not displaying at Center

In iOS 7 You cannot adjust the size of a modally presented view controller anymore.

You want to use the UIModalPresentationStyleCustom mode and then supply your own custom transition using the new APIs available in iOS 7+

See the following links for more info:

http://www.objc.io/issue-5/view-controller-transitions.html

http://www.teehanlax.com/blog/custom-uiviewcontroller-transitions/

http://objectivetoast.com/2014/03/17/custom-transitions-on-ios/

Show' segue in Xcode 6 presents the viewcontroller as a modal in iOS 7

This solution is different from the others in the following ways:

  1. It includes a method to examine and verify the issue
  2. The cause of the issue is traced to the source (a change in the segue type)
  3. The solution is very simple (delete and recreate a new segue)
  4. Please note the requirements in the text

I just gave a very detailed SO answer that fully explains what is happening and why, but the simple solution is you can delete the Segue that is not pushing and then recreate it on the storyboard. The reason is that there is likely a broken bit of xml in the segue (see extended answer for example/instructions how to confirm this issue).

After you confirm that you have at least one UINavigationController within the view hierarchy, be sure that the segue is NOT a manual segue and does NOT have an action associated with it (by viewing the segue in the storyboard as Source Code). Delete the existing segue and then Ctrl-drag from a UIView/UIControl to the target view controller and if custom action is needed intercept the call to destination controller in prepareForSegue.

Also to confirm that this solution works for you please do the
following:

  • Verify that your initial view controller (with the arrow on it) is a
    UINavigationController and that it has a normal content view
    controller as it's root view controller. (or that you embed your
    initial view controller inside of a UINavigationController)
  • Read my extended comments on an earlier response to a very similar question (linked above).

iOS 7: Keyboard not showing after leaving modal ViewController

After deleting tons of code, I finally found out that a custom NavigationController was being used and this was the root cause:

@implementation MSLNavigationController

- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationPortrait;
}

- (BOOL)shouldAutorotate
{
return NO;
}

@end

The app doesn't need this code, so I've nuked the file. (But an explanation as to why this would be hiding the keyboard would be awesome :))

How to present a half modal view controller over the top with iOS 7 custom transitions

One way to do it is to add the "half modal" controller as a child view controller, and animate its view into place. For this example, I created the "half modal" controller in the storyboard with a frame that's half the height of a 4" iPhone screen. You could use more dynamic methods to account for different screen sizes, but this should get you started.

@interface ViewController ()
@property (strong,nonatomic) UIViewController *modal;
@end

@implementation ViewController

- (IBAction)toggleHalfModal:(UIButton *)sender {
if (self.childViewControllers.count == 0) {
self.modal = [self.storyboard instantiateViewControllerWithIdentifier:@"HalfModal"];
[self addChildViewController:self.modal];
self.modal.view.frame = CGRectMake(0, 568, 320, 284);
[self.view addSubview:self.modal.view];
[UIView animateWithDuration:1 animations:^{
self.modal.view.frame = CGRectMake(0, 284, 320, 284);;
} completion:^(BOOL finished) {
[self.modal didMoveToParentViewController:self];
}];
}else{
[UIView animateWithDuration:1 animations:^{
self.modal.view.frame = CGRectMake(0, 568, 320, 284);
} completion:^(BOOL finished) {
[self.modal.view removeFromSuperview];
[self.modal removeFromParentViewController];
self.modal = nil;
}];
}
}


Related Topics



Leave a reply



Submit