-1
NSString *imageName = [NSString stringWithFormat:@"%@UploadedImages/%@",appDel.serverUrl,[[sCatArray objectAtIndex:indexPath.row] objectForKey:@"SubCategoryIcon"]];

in imageName string getting the string as given below., How to convert these url to an image

http://appliicdev.xtechnologies.com/iapp/UploadedImages/5bc77bdd-3eaf-4491-813a-5aedcbfbba41.jpg

Thanks

SARATH SASI
  • 1,395
  • 1
  • 15
  • 39

3 Answers3

3

You can use imageWithData from UIImage. Like,

UIImage *image =[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:imageName]]];
arthankamal
  • 6,341
  • 4
  • 36
  • 51
2

your coding is fine

change this line

NSString *imageName = [NSString stringWithFormat:@"%@UploadedImages/%@",appDel.serverUrl,[[sCatArray objectAtIndex:indexPath.row] objectForKey:@"SubCategoryIcon"]];

into bz ur URL contains /UploadedImages/

NSString *imageName = [NSString stringWithFormat:@"%@/UploadedImages/%@",appDel.serverUrl,[[sCatArray objectAtIndex:indexPath.row] objectForKey:@"SubCategoryIcon"]];

yourimageName.image =[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:imageName]]];

will u need to load the UIImage in quickly` use

  1. Asynchronous FreeLoader

  2. SDWebImage

when I try your image in browser it showing the error so check once path is valid or not otherwise your image name is valid or not

enter image description here

Anbu.Karthik
  • 82,064
  • 23
  • 174
  • 143
-1

Try this:

NSString *imageName = [NSString stringWithFormat:@"%@UploadedImages/%@",appDel.serverUrl,[[sCatArray objectAtIndex:indexPath.row] objectForKey:@"SubCategoryIcon"]];
UIImage *imgObj = [UIImage imageWithData: [NSData dataWithContentsOfURL: [NSURL URLWithString:imageName]]];
_yourImgView.image=imgObj;
Yasika Patel
  • 6,356
  • 3
  • 19
  • 21