我有一个UITableView,我通过initWithFrame动态添加。
- (void)twitterUpdate {
twitterTable = [[UITableView alloc] initWithFrame:CGRectMake(40, 100, 420, 750)];
twitterTable.delegate = self;
twitterTable.backgroundColor = [UIColor clearColor];
twitterTable.separatorColor = [UIColor darkGrayColor];
twitterTable.dataSource = self;
[twitterView addSubview:twitterTable];
}
不幸的是,
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
虽然我有,但没有被调用
<UITableViewDataSource, UITableViewDelegate>
在我的标题中定义。
关于为什么不调用这个的任何想法? twitterUpdate正在通过
进行调用[self performSelectorOnMainThread:@selector(twitterUpdate) withObject:self waitUntilDone:YES];
并将表格绘制到页面中。我也有
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
返回有效的NSInteger。
你无法动态创建这样的表吗?
答案 0 :(得分:3)
请务必致电:
[twitterTable reloadData];