我有我的應用程序一的tableview,我建的NIB,我通過大小檢查將高度設置爲68你在哪裏設置UITableView的高度或框架? AwakeFromNib?
我也做在我的代碼如下。
- (void) viewDidAppear:(BOOL)animated
{
self.tableView.frame = CGRectMake(0,0,320,68);
self.tableView.scrollEnabled = NO;
}
- (void)viewDidUnload
{
[super viewDidUnload];
}
- (void)awakeFromNib
{
[self.tableView setBackgroundColor:[UIColor clearColor]];
self.tableView.rowHeight = 68;
}
當我在模擬器或iPhone上運行應用程序時,它看起來很好,因爲表格只有68px高。如果我關閉了應用程序(進入主屏幕)並重新打開它,桌子不再只有68px高,但它佔據了整個屏幕。
我似乎無法讓它始終保持68px?
除了我上面的問題是否有一個方法(awakeFromNib,ViewDidAppear等),你應該始終只設置對象的大小或位置?