【发布时间】:2011-07-16 12:20:07
【问题描述】:
我确信这很简单,但我找不到任何关于它的文档..
在我的 uitableview 中,我的文本标签向右对齐(我的应用程序在 heberw 中,即 rtl) 我正在尝试将图像添加到文本标签右侧的单元格中,没有运气,到目前为止,图像与左侧对齐,我找不到将其与单元格右侧对齐的方法。
这是我的代码:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
}
cell.imageView.image = [UIImage imageNamed:@"tableicon.png"];
NSString *cellValue = [[stories objectAtIndex:indexPath.row] objectForKey:@"ArticleTitle"];
cell.textLabel.text = cellValue;
cell.textLabel.textAlignment = UITextAlignmentRight;
cell.textLabel.font = [UIFont systemFontOfSize:17];
cell.textLabel.numberOfLines = 2;
return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return 50;
}
【问题讨论】:
标签: xcode uitableview cell alignment