0

此代码有效:[self.tableView reloadData],但如果我扩展这样的loadView方法UITableViewController

- (void) loadView {
    [super loadView];
    float headerHeight = 80;
    UIView *tableV = self.tableView;
    CGRect tableFrame = self.tableView.frame;

    self.view = [[UIView alloc] initWithFrame:self.tableView.frame];
    [self.view release];

    tableFrame.origin.y += headerHeight - [UIApplication sharedApplication].statusBarFrame.size.height;
    tableFrame.size.height -= headerHeight;
    tableV.frame = tableFrame;
    [self.view addSubview:tableV]; 
}

tableView 数据不会重新加载。我究竟做错了什么?

4

1 回答 1

0

在 UITableViewController 中,self.view == self.tableView,所以在第 7 行 ( self.view = [[UIView...) 中,您实际上是在替换 self.view 和 self.tableView。

如果您只想向下移动表格视图,请尝试使用 contentInset。

于 2011-08-27T20:39:18.817 回答