详解IOS UITableViewCell 的 imageView大小更改
详解IOSUITableViewCell的imageView大小更改
实例代码:
-(UITableViewCell*)tableView:(UITableView*)tableViewcellForRowAtIndexPath:(NSIndexPath*)indexPath{
staticNSString*CellIdentifier=@"Cell";
UITableViewCell*cell=[tableViewdequeueReusableCellWithIdentifier:CellIdentifier];
if(cell==nil){
cell=[[UITableViewCellalloc]initWithStyle:UITableViewCellStyleValue1reuseIdentifier:CellIdentifier];
cell.textLabel.text=[self.arrStrobjectAtIndex:indexPath.row];
UIImage*img=[UIImageimageNamed:[self.arrImgobjectAtIndex:indexPath.row]];
cell.imageView.image=img;
//iOSUITableViewCell的imageView大小更改
CGSizeitemSize=CGSizeMake(img.size.width*2/3,img.size.height*2/3);
UIGraphicsBeginImageContext(itemSize);
CGRectimageRect=CGRectMake(0.0,0.0,itemSize.width,itemSize.height);
[cell.imageView.imagedrawInRect:imageRect];
cell.imageView.image=UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}
returncell;
}
以上就是关于IOSUITableViewCell的imageView大小更改的实例,本站还有很多关于IOS开发的文章,欢迎大家搜索参阅,
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
热门推荐
1 训练狗狗憋尿
2 狗狗追踪训练
3 狗狗训练要多少钱
5 深圳狗狗训练
6 训练狗狗唤回
7 狗狗叫怎么训练
8 狗狗训练班
10 狗狗社会化训练
11 狗狗叫回训练
12 广州狗狗训练学校
13 狗狗训练躺下
14 狗狗随行训练
15 训练狗狗巡回
16 狗狗要怎么训练
17 狗狗喂食训练
18 训练狗狗躺下