I have the mainWindow.xib in my application with a TabController in it for my main-menu.
Now I want to have a Login-form for my application.
I added a View (LoginViewController) and show this view at beginning:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
// Add the tab bar controller's current view as a subview of the window
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
LoginViewController *lvc = [[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil];
lvc.delegate = self;
[self.tabBarController presentModalViewController:lvc animated:false];
[lvc release];
return YES;
}
Next I have my login-checks in the view, okay.
Now I try to dismiss the view after this.
For this I searched around and found the question here: present modal view controller
I add all things to my project, but getting a error in this code:
#import <UIKit/UIKit.h>
@interface Animexx3AppDelegate : NSObject <UIApplicationDelegate,
UITabBarControllerDelegate, LoginViewControllerDelegate>
{
UIWindow *window;
UITabBarController *tabBarController;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UITabBarController *tabBarController;
@end
Which means “cannot find protocol LoginViewControllerDelegate” in line 2/3.
Addition in the line “lvc.delegate = self” I get a warning that tells me “assigning to “id” from incompatible type “Animexx3AppDalagte”.
What did Im wrong?
You need to import the header file where you declared the
LoginViewControllerDelegateprotocol. Most likely theLoginViewController.hfile.