-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,365
  • 1
  • 15
  • 37

3 Answers3

3

You can use imageWithData from UIImage. Like,

UIImage *image =[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:imageName]]];
arthankamal
  • 5,955
  • 2
  • 35
  • 48
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
  • 80,161
  • 21
  • 166
  • 138
-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,166
  • 3
  • 17
  • 21