Jan49
Jan49

Reputation: 1818

[ dismissViewControllerAnimated:YES completion:nil]; not working for iOS device 7

  [ dismissViewControllerAnimated:YES completion:nil]; 

Not working for ios7 device, but its working fine for simulator. I know this question is already asked but no answer i found there. XCODE version: 6.1 Iphone 4s ios7

- (IBAction)createThread:(id)sender {

  UIViewController *vc = [self presentingViewController]; //ios 5 or later
 [self dismissViewControllerAnimated:YES completion: nil];

  [[vc presentingViewController] dismissViewControllerAnimated:YES completion:nil];
 }

Actually i want to go to 1st view controller from 3rd view controller. It worked for simulator, but in iphone 3rd view controller is disappeared but it is stuck at 2nd view controller not going to first view controller.

Upvotes: 0

Views: 4042

Answers (2)

ZeMoon
ZeMoon

Reputation: 20274

You could also attempt a cascade type effect using the following code:

UIViewController *vc = [self presentingViewController]; //ios 5 or later
[self dismissViewControllerAnimated:YES completion:^{
    [[vc presentingViewController] dismissViewControllerAnimated:YES completion:nil];
}];

Upvotes: 0

Ilario
Ilario

Reputation: 6079

if you want to go to 1st UIViewController from 3rd try this:

[[[self presentingViewController] presentingViewController] dismissViewControllerAnimated:YES completion:nil];

Upvotes: 1

Related Questions