我有一個UITableView加載一些鳴叫,所有的作品很好,但是當我填充表時,它不會進入到CellForRow方法,直到我觸摸表視圖....有人知道如何解決這個問題嗎?爲什麼UITableView在我觸摸時顯示數據?
tab = [[UITableView alloc] initWithFrame:CGRectMake(10, 300, 400, 200) style:UITableViewStylePlain];
tab.dataSource = self;
tab.delegate = self;
然後...
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"entra a cellula");
Tweet *t = [tweets objectAtIndex:indexPath.row];
static NSString *MyIdentifier = @"MyIdentifier";
// Try to retrieve from the table view a now-unused cell with the given identifier.
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
// If no cell is available, create a new one using the given identifier.
if (cell == nil) {
// Use the default cell style.
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:MyIdentifier];
}
cell.textLabel.text = t.screenName;
cell.detailTextLabel.text = t.text;
cell.imageView.image = t.profileImage;
return cell;
}
哪裏代碼添加tableview中作爲一個子視圖? – hukir
緊跟在tab.delegate = self指令之後... [self addSubview:tab];然而,表顯示,但無效......只是當我觸摸它,它是填充... –
你是否正在加載與後臺線程這些鳴叫? – ohr