详解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开发的文章,欢迎大家搜索参阅,
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
热门推荐
10 分别发的祝福语简短
11 大外甥高考祝福语简短
12 小学毕业校长简短祝福语
13 搞工程发财祝福语简短
14 冬季祝福语男生文案简短
15 同事生子问候祝福语简短
16 退休文案寄语简短祝福语
17 送给自己的祝福语简短
18 简短祝福语毛笔字