Hello.
I have a TableView and I want the same image to be in the whole first section. Then have the whole second section have a different image to the first section.
The image array just has the file names.
Thanks!
I have a TableView and I want the same image to be in the whole first section. Then have the whole second section have a different image to the first section.
Code:
- (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];
}
// Configure the cell...
cell.textLabel.text = [[arrayarray objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
cell.backgroundColor = [UIColor colorWithWhite:100 alpha:.60f];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(50,5,20,20)];
imageView.image = [UIImage imageNamed:[imagesarray objectAtIndex:indexPath.section]];
[cell addSubview:imageView];
return cell;
}
The image array just has the file names.
Thanks!