我正在尝试将表格视图动画化到我的视图中,但是我无法让 UITableView 中的数据出现(下面的 NAConversationViewController 是 UITableViewController 的子类):
Post *post = [self.fetchedResultsController objectAtIndexPath:indexPath];
UIView *takeover = [[UIView alloc] initWithFrame:self.view.frame];
takeover.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.75];
NAConversationViewController *vc = [[NAConversationViewController alloc] initWithNibName:@"NAConversationViewController" bundle:nil];
vc.managedObjectContext = self.managedObjectContext;
vc.post = post;
vc.view.frame = CGRectMake(0, self.view.frame.size.height, 320, 320);
[takeover addSubview:vc.view];
[self.view addSubview:takeover];
[UIView animateWithDuration:0.2
animations: ^{
vc.view.frame = CGRectMake(0, 100, 320, 320);
}
completion:^(BOOL finished) {
if (finished) {
[vc.view setNeedsDisplay];
}
}];
我可以让表格数据显示的唯一方法是 [vc.view setNeedsDisplay]; 但是一旦我在表格视图上滚动,表格单元格就会立即消失。
我是否错误地调用了 UITableView?