I am making a splitview application for ipad and I need to display a different view controller for login purposes. I call this in the didFinishLaunchingWithOptions function in Appdelegate:
LoginViewController *login = [[LoginViewController alloc] init];
[info setModalTransitionStyle: UIModalTransitionStyleCrossDissolve];
[self presentViewController:login animated:YES completion: nil];
but I get the error "No visible @interface for AppDelegate declares the selector presentViewController" on the third line.
The view controller I want to display is set to the LoginViewController class. I have Imported all classes.
I am pretty new to programming and would really appreciate any help!
Thanks!!
What the error message says is that the class AppDelegate does not contain a method called presentViewController. Indeed, that method belongs to UIViewController class.
What you should do depends on how you created your project, whether it uses a navigation controller, a tab bar controller, or a simple view controller.
From your comment, I understand you used the Window-based template (or Empty application) to create your project. In this case, in your application:didFinishLaunching: you should have something like this:
self.login = [[LoginViewController alloc] init];
[self.window addSubview:self.login.view];
and also add to your AppDelegate.h the following declaration:
@property (nonatomic, strong) LoginViewController* login;
If this seems not to apply to your case, please, post your definition of application:didFinishLaunching:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With