-1

I need my cell's image view to have an area of 44x44 pixels so that it can be tapped. However, when I tried doing that, my 26x26 image got scaled to 44x44 without my permission, so now my 26x26 image is huge and blurry. I need to keep the 26x26 image at 26x26 but also increase the imageView frame to 44x44. This is what I've done but it hasn't worked:

//UITableViewCell subclass method

- (void) layoutSubviews {
    [super layoutSubviews];
    self.imageView.frame = CGRectMake(0, 0, 44.0, 44.0);
    self.imageView.contentMode = UIViewContentModeScaleAspectFit;
}

//TableView method    
-(void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath {
 UIImage *originalImage = [UIImage imageNamed:@"unchecked.png"];
 CGRect screenRect = CGRectMake(0, 0, 26.0, 26.0);
 UIGraphicsBeginImageContext(screenRect.size);
 [originalImage drawInRect:screenRect];
 cell.imageView.image = UIGraphicsGetImageFromCurrentImageContext();
 UIGraphicsEndImageContext(); 
}
4

1 回答 1

2

尝试将内容模式设置为中心:

self.imageView.contentMode = UIViewContentModeCenter;
于 2013-07-31T04:17:42.523 回答