我需要在单元格中加载图像,我的图像上有一个白色边框。我从链接调用图像,它看起来像这样。
但是我的图片看起来像
我的图像左侧和右侧出现白色边框。这是我的图像代码
UIImageView *item=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 115, 130)];
NSString *imgstring=[NSString stringWithFormat: @"%@",[[mutarray objectAtIndex:indexPath.row ] valueForKey:@"imgurl"]];
NSURL *imgurl=[NSURL URLWithString:imgstring];
UIImage *image=[UIImage imageWithData:[NSData dataWithContentsOfURL:imgurl]];
[item setBackgroundColor:[UIColor clearColor]];
item.contentMode=UIViewContentModeScaleToFill;
[item setImage:image];
[cell.contentView addSubview:item];
请指导...
最佳答案
那些白色边框在您在问题中发布的图片中……这就是它们也出现在 iOS 中的原因。在照片编辑器中打开该图片,您会看到。
关于ios - UIImageView 设置为 ASpectFill 时出现内容模式问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11633405/