Cocoa touch 在UITableView中对齐图像

Cocoa touch 在UITableView中对齐图像,cocoa-touch,ios,uitableview,uiimageview,Cocoa Touch,Ios,Uitableview,Uiimageview,我已经创建了一个表格,在指定的图像旁边显示一些用户输入(有点像facebook应用程序上的墙贴)。但是,默认对齐方式沿单元高度居中。我希望默认对齐方式位于左上角。有没有一种方法可以在不创建自定义单元格的情况下执行此操作?这是我的代码: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdent

我已经创建了一个表格,在指定的图像旁边显示一些用户输入(有点像facebook应用程序上的墙贴)。但是,默认对齐方式沿单元高度居中。我希望默认对齐方式位于左上角。有没有一种方法可以在不创建自定义单元格的情况下执行此操作?这是我的代码:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

static NSString *CellIdentifier = @"Cell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    cell.textLabel.lineBreakMode = UILineBreakModeWordWrap;
    cell.textLabel.numberOfLines = 0;
    cell.textLabel.font = [UIFont fontWithName:@"Helvetica" size:12.0];
    }

// Configure the cell.
[[cell imageView] setImage:[UIImage imageNamed:[[[userData objectAtIndex:indexPath.section] objectAtIndex: indexPath.row] objectForKey:@"picture"]]];
[[cell textLabel] setText:[[[userData objectAtIndex:indexPath.section] objectAtIndex: indexPath.row] objectForKey:@"post"]];

return cell;
}


谢谢

如果需要更好地控制其布局,请不要使用“提供的图像”属性,而是将自己的UIImageView作为子视图添加到单元格中,并根据需要对其进行定位

在Xcode文档中,请参阅《表视图编程指南》>详细查看表视图单元格>自定义单元格&清单5-3将子视图添加到单元格的内容视图