我有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