UITableViewCell с изображением справа? - PullRequest
45 голосов
/ 23 апреля 2009

Есть ли способ настроить отображение изображения UITableViewCell.i справа от ячейки, а не слева? Или мне нужно будет добавить отдельный UIImageView на правой стороне макета ячейки?

Ответы [ 11 ]

0 голосов
/ 01 марта 2010

Этот Soln предназначен для добавления разных изображений в каждую ячейку .... Просто попробуйте

// Customize the appearance of table view cells.
- (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];
}

if(indexPath.row == 0) {
    cell.image = [UIImage imageNamed:@"image.png"];
}

else if (indexPath.row == 1) {
    cell.image = [UIImage imageNamed:@"image1.png"];
}
...