|
新建一个 window-base appliction 双击 mainwindow.xib #import <UIKit/UIKit.h>
@interface tabbarTestAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
UITabBarController *tabBarController;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UITabBarController *tabBarController;
@end
主类.m @synthesize tabBarController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
[self.window addSubview:tabBarController.view];//这里应该是启动显示tabbar control吧?
[self.window makeKeyAndVisible];
return YES;
}
[tabBarController release];
为什么启动程序没有显示新建的tabbar control,而是显示window? |
|
|
可以正常显示啊,直接在IB下面把tabbar control拖到window下,做为window的子视图就行了。
|
|
| 25分 |
需要在IB里手动关联tabcontroller到appdelegate里定义的tabcontroller变量.
|
|
为什么要这么关联呢?其中的原理是什么? |
|
|
1楼都说了
是做为它的 子视图 |
|
| 10分 |
IB 这个东西很容易把人搞糊涂了,而且一旦出问题也不好查找。
设计的想法是好的:UI设计与编码设计分离 只是太不好用了,更多还是喜欢用代码敲,而不是用IB布局。 |
| 5分 |
关联类似MS系统下的事件注册。
|
|
直接按Control建将App Delegate拖拽到tabbarController就能完成手动关联吗?但是我这样关联以后为什么还是不能现实tabbarController
|
|