我有UINavigationBar的視圖: 的AppDelegate:通過initWithFrame添加子視圖。 UINavigationBar的大小
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
_homeScreen = [[PrepareScreen alloc] init];
self.mainViewController = [[MyViewController alloc] initWithScreenDef:[self.homeScreen projectHomeScreen] AndBounds:self.window.bounds];
self.navigationController = [[UINavigationController alloc] initWithRootViewController:self.mainViewController];
self.window.rootViewController = self.navigationController;
[self.window makeKeyAndVisible];
return YES;
後來才知道有一類
MyViewController : UIView <UITableViewDataSource,UITableViewDelegate>
我
的.h文件
,我有:
- (void)viewDidLoad
{
[super viewDidLoad];
self.myTableView = [[UITableView alloc] initWithFrame:self.view.bounds];
[self.view addSubview:self.myTableView];
}
之後,我有一個錯誤的他屏幕的ight。我希望我的myTableView有一個size.height-49.0
卓越的解決方案。謝謝! – Kuba 2012-04-26 14:57:12
只有一個補充,你可以在viewWillAppear:中創建你的表格視圖,只要你不做大量的操作。通常使用viewWillAppear來進行輕量級操作 - 主要是幾何圖形調整。 – graver 2012-04-26 14:59:36
好的,所以當我想從我的模型類中放入數據是更好的做到這一點viewDidLoad,當我試圖調整大小單元格或更改背景顏色(例如)我應該使用viewWillAppear,對不對? – Kuba 2012-04-26 15:02:06