我在我的应用程序中使用了主窗口,其中有一个TabController用于我的主菜单。iOS:如何显示登录表单?
现在我想为我的应用程序提供登录表单。 我添加了一个视图(LoginViewController),并显示在开始这样的观点:
- (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;
}
接下来,我必须在我的观点登录的检查,还行。
现在我尝试在此之后关闭视图。 为此,我寻找了一圈,发现这里的问题是:present modal view controller
我所有的东西添加到我的项目,但得到一个错误在此代码:
#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
这意味着“找不到协议LoginViewControllerDelegate”看齐2/3。
加在该行“lvc.delegate =自我”我知道,告诉我一个警告“分配给‘ID’从类型不兼容‘Animexx3AppDalagte’。
什么了我错了?
请将'false'布尔文字改为'NO',它与Cocoa定义的文字相同。你会注意到你的代码读得更好,和我一样的Objective-C程序员在我们看到你的代码时不会畏缩:)。 – PeyloW