Chciałbym ustawić marginesy lub paddings dla komórek UITableView imageView, w jaki sposób mogę to zrobić? Z heightForRowAtIndexPath
mogę ustawić wysokość wierszy. I po prostu powiększa obraz w komórce, jeśli go zwiększę.UITableViewCell imageView padding
Oto moja metoda cellForRow
- (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;
}
Obecnie Znam tylko jeden sposób, jak mogę to zrobić - kurczyć zawartość obrazu z obrazów przy użyciu programu Photoshop lub similiar podczas pobytu w tym samym czasie. Ale taka metoda zajęłaby dużo czasu i wydaje mi się, że powinien istnieć łatwiejszy sposób na zrobienie tego.
To sprytny pomysł! Nawiasem mówiąc, wyrażenie po prawej stronie można dodatkowo uprościć do 'CGAffineTransformMakeScale (0.5, 0.5)'. – Pang
Nie działa dla mnie. –