UITableViewCell с изображением справа?

Этот код дает тот же результат

foreach( $file as $line )
{   
    echo $line; //display "www.google.be"
    echo $string; //also display "www.google.be"
    //but when I then if the line contain the string, the function doesn't find 
      it!!!
    $pos = stripos($line,$hostname);
    var_dump($pos); // FALSE for all the test
}

Я сделал это в другом коде, и у меня никогда не было этой проблемы.

46
задан Oliver GL 23 April 2009 в 05:16
поделиться

2 ответа

Нет. Но вы можете легко добавить представление изображения как вспомогательное представление к ячейке таблицы для того же эффекта.

UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"foo.png"]];
cell.accessoryView = imageView;
[imageView release];
80
ответ дан 26 November 2019 в 20:18
поделиться

Это решение для добавления разных изображений в каждую ячейку....Just a Try

// 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"];
}
0
ответ дан 26 November 2019 в 20:18
поделиться