关于在表格视图单元格中放置图像,我有一个非常简单的问题。目前我的图像显示在表格单元格的右侧,我希望它们显示在左侧。我的表设置代码如下所示。
有人可以帮忙吗?感谢。
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MyCell"];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"MyCell"];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero] autorelease];
UIButton *myAccessoryButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 60, 60)];
[myAccessoryButton setBackgroundColor:[UIColor clearColor]];
[myAccessoryButton setImage:[UIImage imageNamed:@"Obama1.jpg"] forState:UIControlStateNormal];
[cell setAccessoryView:myAccessoryButton];
[myAccessoryButton release];
}
cell.textLabel.font = [UIFont systemFontOfSize:20];
NSString *imageName = [imagesList objectAtIndex:indexPath.row];
cell.imageView.image = [UIImage imageNamed:imageName];
cell.textLabel.text = [tableData objectAtIndex:indexPath.row];
return cell;
}