0

I am trying to move the new view controller from my current view controller i am using the following code to do this

self.loginView = [self.storyboard instantiateViewControllerWithIdentifier:@"LOGIN"];
[self presentViewController:self.loginView animated:NO completion:nil];

This code works fine for the iOS 8 but in iOS 7(iPhone) it is not working. Can someone help me so get rid of this error?

Tarun Sharma
  • 601
  • 3
  • 13
  • 31
  • Are you getting any sort of error when running this in the iOS 7 simulator? – Kai Schaller Nov 27 '14 at 05:57
  • Presenting view controllers on detached view controllers is discouraged – Tarun Sharma Nov 27 '14 at 06:00
  • Sounds like this might do the trick: http://stackoverflow.com/questions/19890761/warning-presenting-view-controllers-on-detached-view-controllers-is-discourage – Kai Schaller Nov 27 '14 at 06:03
  • I have tried this but not working for me – Tarun Sharma Nov 27 '14 at 06:05
  • If you'd like to upload a small sample project that demonstrates the issue it would be easier to troubleshoot. It's difficult to diagnose the problem without being able to see what you're working with. – Kai Schaller Nov 27 '14 at 06:06
  • This code is working fine on the iPad with iOS 7 but not with the iPhone on iOs 7. On touch of button i am just moving to next view controller nothing more than that i am doing – Tarun Sharma Nov 27 '14 at 06:48

1 Answers1

-1

Please try to use [self.view.window.rootViewController presentViewController:self.loginView animated:NO completion:nil];

Jonhory
  • 1
  • 3