0

I'm adding dynamic 3D touch quick actions to my iOS app.

I was able to setup the code that displays each action, but I am having trouble finding what code would go within the code below. When the action is chosen, I need the action to open up one of 4 different view controllers within my app.

if ([shortcutItem.type isEqualToString:@"addOpportunity"]) {

} else if ([shortcutItem.type isEqualToString:@"bookMark"]) {

} else if ([shortcutItem.type isEqualToString:@"searchGuest"]) {

} else if ([shortcutItem.type isEqualToString:@"myGuest"]) {

}

else {


}

}

Arun Xavier
  • 763
  • 8
  • 47
John
  • 1
  • 2

1 Answers1

0

First you will have to create the instances of the view controllers that you intend to show in each of the if conditions.

For example:-

SearchGuestViewController * vc = [[SearchGuestViewController alloc] init];

Next you can present the view controller modally by doing the following:-

[self presentViewController:vc animated:YES completion:nil]; Note: You can only present a view controller from within another view controller.

This is one way of launching a view controller.

Read more about launching view controllers in the link below. https://developer.apple.com/library/content/featuredarticles/ViewControllerPGforiPhoneOS/PresentingaViewController.html

grane2212
  • 764
  • 1
  • 10
  • 29