1.經過設置 圖形上下文
spa
1
2
3
4
5
6
7
8
|
CGSize itemSize = CGSizeMake(40, 40);
UIGraphicsBeginImageContext(itemSize);
CGRect imageRect = CGRectMake(0.0, 0.0, itemSize.width, itemSize.height);
[cell.imageView.image drawInRect:imageRect];
cell.imageView.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
|
2. 只有在UITableViewCell子類中重寫layoutSubviews方法去改變這些值,舉例code
-(void)layoutSubviews orm
{ ci
[super layoutSubviews];it
[self.imageView setFrame:CGRectMake(10, 10,29, 29)];table
self.imageView.contentMode = UIViewContentModeScaleAspectFit;class
}方法