0

I have a popup view from another view controller with an XIB file. It launches from a parent VC (detailViewController) and but the dismiss code is within its own VC (KNThirdViewController)

I'm using this code: https://github.com/kentnguyen/KNSemiModalViewController/blob/master/KNSemiModalViewControllerDemo/KNThirdViewController.xib

When this is called from (KNThirdViewController)

- (IBAction)dismissButtonDidTouch:(id)sender {
    [self dismissModalViewControllerAnimated:NO];
}

The app returns to the rootViewController and not the detailViewController. It should simply dismiss itself (the KNThirdViewController popup VC) and return the user to detailViewController.

The view controller is presented with:

-(void)scriviBtnPress {

// You can also present a UIViewController with complex views in it
// and optionally containing an explicit dismiss button for semi modal
[self presentSemiViewController:semiVC withOptions:@{
 KNSemiModalOptionKeys.pushParentBack    : @(YES),
 KNSemiModalOptionKeys.animationDuration : @(0.5),
 KNSemiModalOptionKeys.shadowOpacity     : @(0.3),
 }];

}

Nevil Lad
  • 533
  • 6
  • 20
user2588945
  • 1,681
  • 6
  • 25
  • 38

2 Answers2

3

Try like this :

[self.presentingViewController.presentingViewController dismissViewControllerAnimated:YES completion:NULL];
Bhavin
  • 27,155
  • 11
  • 55
  • 94
NHS
  • 409
  • 2
  • 7
0

dismissModalViewControllerAnimated: method is deprecated in iOS 6.0. why don't try with dismissViewControllerAnimated:completion:

Bhavin
  • 27,155
  • 11
  • 55
  • 94
slysid
  • 5,236
  • 7
  • 36
  • 59
  • thanks! but that is not going to fix the problem I'm having. My current method works - it dismisses the vc but goes too deep and returns us to the root vc instead of the detailvc – user2588945 Aug 29 '13 at 09:54
  • Well, are you presenting the modal VC from a Navigation controller or you push your modal VC from another modal VC? If it is latter case, it sounds like your VC are stacked away until it reaches the root VC. – slysid Aug 29 '13 at 10:19
  • http://stackoverflow.com/questions/3221510/dismissing-modal-view-controllers?rq=1. This post involves issue similar to yours i guess. No accepted answer but you can have a look at it. – slysid Aug 29 '13 at 10:22