rounded image using SDWebImage

I want to use SDWebImage in my code to use cache with my images but I want to use rounded images.

With this code I have rounded images and works perfect:

NSString *imageURL = [noticia objectForKey:@"imagem"];

UIImageView *imgView=[[UIImageView alloc] initWithFrame:CGRectMake(20, 5, 90, 70)];
imgView.backgroundColor=[UIColor clearColor];
[imgView.layer setCornerRadius:30];
[imgView.layer setMasksToBounds:YES];
[imgView setImageWithURL:[NSURL URLWithString:imageURL]];
cell.imageView.image = UIGraphicsGetImageFromCurrentImageContext();
[cell.contentView addSubview:imgView];

But I need to use SDWebImage and cache too so I have this code:

[cell.imageView setImageWithURL:[NSURL URLWithString:imageURL] placeholderImage:[UIImage imageNamed:@"placeholder.png"] ];

I want to know how I merge the codes to use SDWebImage and rounded image.

I tried this code but not worked:

UIImageView *imgView=[[UIImageView alloc] initWithFrame:CGRectMake(20, 5, 90, 70)];
imgView.backgroundColor=[UIColor clearColor];
[imgView.layer setCornerRadius:30];
[imgView.layer setMasksToBounds:YES];
[imgView setImageWithURL:[NSURL URLWithString:imageURL]];
[cell.imageView setImageWithURL:[NSURL URLWithString:imageURL] placeholderImage:[UIImage imageNamed:@"placeholder.png"] ];
[cell.contentView addSubview:imgView];

Answers


Try this: Replace your code

  UIImageView *imgView=[[UIImageView alloc] initWithFrame:CGRectMake(20, 5, 90, 70)];
  imgView.backgroundColor=[UIColor clearColor];
 [imgView.layer setCornerRadius:30];
 [imgView.layer setMasksToBounds:YES];
 [imgView setImageWithURL:[NSURL URLWithString:imageURL]];
 [cell.imageView setImageWithURL:[NSURL URLWithString:imageURL] placeholderImage:[UIImage imageNamed:@"placeholder.png"] ];

with below code And Import "QuartzCore/QuartzCore.h" Framework

 cell.imageView.backgroundColor=[UIColor clearColor];
 [cell.imageView.layer setCornerRadius:30];
 [cell.imageView.layer setMasksToBounds:YES];
 [cell.imageView setImageWithURL:[NSURL URLWithString:imageURL] placeholderImage:       [UIImage imageNamed:@"placeholder.png"] ];

Need Your Help

Which are the IP-Ranges for Elastic Beanstalk?

amazon-web-services ip elastic-beanstalk

I´m being asked for my site´s IP Ranges and it is hosted in Elastic Beanstalk (US East (N.Virginia)). Can somebody tell me which are them currently, or where to look?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.