Try this..
// 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:@"image1.png"];
}
else if (indexPath.row == 1)
{
cell.image = [UIImage imageNamed:@"image2.png"];
}
Quote:
Originally Posted by apiphone
With this code it will show the same image (ww.png) on each row. You have to provide different image name for each row, you can simple write
Code:
if (row == 0)
{
cell.image = [UIImage imageNamed:@"ww.png"];
}
else if (row == 1)
{
cell.image = [UIImage imageNamed:@"ww1.png"];
}
Or count the number of rows and have a loop with different row images.
Hope this helps
|