0
我正在构建一个需要viewcontroller和tab bar控制器的应用程序。在viewcontroller和Tab bar控制器之间切换
当我启动应用程序时,它应该加载视图控制器(这是登录屏幕),从那里我需要去实际应用程序启动的tabbar控制器视图。
这是我曾尝试:
appdelegate.h
#import <UIKit/UIKit.h>
@interface IeAppDelegate
: NSObject <UIApplicationDelegate, UITabBarControllerDelegate> {
UIWindow *window;
UITabBarController *tabBarController;
UIViewController *LoginController;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UITabBarController *tabBarController;
@property (nonatomic, retain) IBOutlet UIViewController *LoginController;
@end
appdelegate.m
@synthesize window;
@synthesize tabBarController;
@synthesize LoginController;
#pragma mark -
#pragma mark Application lifecycle
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
// Add the tab bar controller's view to the window and display.
LoginController = [[LoginController alloc] init];
[window LoginController.view];
[window addSubview:tabBarController.view];
[window makeKeyAndVisible];
return YES;
}
我收到这些错误和警告。我究竟做错了什么?
warning: 'UIViewController' may not respond to '-alloc' warning: (Messages without a matching method signature warning: will be assumed to return 'id' and accept warning: '...' as arguments.) error: expected ']' before '.' token warning: 'UIWindow' may not respond to '-LoginController'
更新:我想通了一个错误:
LoginController = [[LoginViewController alloc] init];
但在此声明:
[window LoginController.view];
我仍然得到: