0
为什么setIndentationLevel
没有获取单元格子视图? 我有一个UITableView
。我的cellForRowAtIndexPath
如下所示。我添加的箭头没有随着文本标签移动。为什么?setIndentationLevel不适用于cell.ContentView子视图
我该怎么做?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
UIImageView *img = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"small_arrow.png"]];
img.frame = CGRectMake(5, 10, 7, 11);
[cell.contentView addSubview:img];
cell.textLabel.text=[[self.tabledata objectAtIndex:indexPath.row] valueForKey:@"name"];
cell.textLabel.font = [UIFont fontWithName:@"Helvetica" size:18];
[cell setIndentationLevel:[[[self.tabledata objectAtIndex:indexPath.row] valueForKey:@"level"] intValue]];
return cell;
}
的NSLog( “%@”,[[[self.tabledata objectAtIndex:indexPath.row] valueForKey:@“level”] intValue]); ....请尝试一下,看看你的consol会显示什么? – 2012-10-11 10:50:20
是的,我试过了。它显示0,1,2,3等...... – Dev
然后你想为你的cell.textLabel设置索引级别多少? – 2012-10-11 10:57:48