使用 AsyncImageView 将图像加载到 ImageView 宽度

Load images using AsyncImageView to ImageView width

我使用 AsyncImageView 从 url 加载图像。但是图像没有加载到图像视图宽度。下面是我的代码。

{
    AsyncImageView *asyImage;
    asyImage = [[AsyncImageView alloc] initWithFrame:frame];
    [asyImage loadImageFromURL:[NSURL URLWithString:url]];
    [propertyImage addSubview:asyImage];
    propertyImage.contentMode = UIViewContentModeScaleAspectFit;
}
 NSString * urlString = @"http://img-paragon.sandicor.com/ParagonImages/Property/Q1/SANDICOR/150016147/0/0/0/729a48630a22f4436d3e45e671bb3548/1/e2d30ecd1633ebc3b6b1f6acbcc77331/150016147.JPG";
NSData *dataCoverImg = [NSData dataWithContentsOfURL:[NSURL URLWithString:urlString]];
UIImage *imgLocation = [UIImage imageWithData:dataCoverImg];
self.image = [imgLocation resizedImage:self.propertyImage.frame.size interpolationQuality:kCGInterpolationMedium]; // Can we resize image using UIImage+Resize equel to imageview size

self.urlForTesting=[NSURL URLWithString:urlString];
 CGRect frame = self.propertyImage.bounds; AsyncImageView *asyImage;
asyImage=[[AsyncImageView alloc] initWithFrame:frame];
asyImage.imageURL =self.urlForTesting;


asyImage.layer.borderWidth = 2.0f;
asyImage.contentMode = UIViewContentModeScaleToFill;
asyImage.layer.masksToBounds=YES;
[self.propertyImage addSubview:asyImage];

self.mySecondImageView.image = self.image; // set directly to asyncimage view with aspect mode AspectFill
self.myThirdImageView.image = self.image; //Set to normal Image view with aspect Mode ScaleToFill
// Do any additional setup after loading the view, typically from a nib.

在此代码中,我为您使用了三个图像视图示例,所有这些示例均根据图像视图大小获得完整图像