I would like to set up fields or paddings for a UITableView cell imageView, how could I do this? With heightForRowAtIndexPath I can only set the height of the rows. And it just enlarges the image in the cell if I enlarge it.
Here is my cellForRow method
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *cellID = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID] autorelease]; cell.textLabel.numberOfLines = 1; cell.textLabel.font = [UIFont systemFontOfSize:kSystemFontSize]; cell.accessoryType = UITableViewCellAccessoryNone; cell.textLabel.textColor = [UIColor whiteColor]; } cell.textLabel.text = [_dataArray objectAtIndex:indexPath.row]; cell.imageView.image = [UIImage imageNamed:[_imageArray objectAtIndex:indexPath.row]]; cell.backgroundColor = [UIColor clearColor]; return cell; }
Currently, I know only one way I could do this - compress the contents of the image images using Photoshop or a similar program while staying at the same time. But such a method will take a lot of time, and I think there should be an easier way to do this.
Datenshi
source share