How to programmatically switch to another view manager with a "current context" view in ios 9, lens C

I create my application using storyboards. So that I can open another view controller when the button is preesed, by dragging and dropping. Then I can choose presentation= over current contextfor segue in the storyboard. But I want to do this programmatically. I found the answer, but he says that it will only work for ipads.Imm creating a universal application, so I want to work on all devices.

  • Is it possible.
  • And how can I do that.

in my first view controller

UIStoryboard *story = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
UIViewController *middleViewController = [story instantiateViewControllerWithIdentifier:@"FlightMiddleViewController"];

and in my second view controller, the viewDidLoad method that I put

self.modalPresentationStyle = UIModalPresentationOverCurrentContext;

. , while, black.I , .

+4
3

iphone ios 9 > =

, .

, , ,

- (IBAction)searchNowAction:(id)sender {

    UIStoryboard *story = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
    UIViewController *secondViewController = [story instantiateViewControllerWithIdentifier:@"secondviewControllerSBname"];


    secondViewController.modalPresentationStyle = UIModalPresentationOverFullScreen;
    secondViewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    [self presentViewController:secondViewController animated:YES completion:nil];

}

iphones.

+7

.

self.modalPresentationStyle = UIModalPresentationStyle.OverCurrentContext

PresentationContext true

, iPad, popover iPad.

+3

In fact, it is not so difficult to make a presentation style OverCurrentContexton the iPhone. Check out the UIViewController custom transition introduced in iOS 7. You’ll learn how to do this.

0
source

Source: https://habr.com/ru/post/1626292/


All Articles