How to display image on UIImageView using URL and NSString in ios?

后端 未结 10 1957
孤城傲影
孤城傲影 2021-01-02 16:49

I want to display image on UIImageView using URL and NSString. I am unable to show image.

My code is:

UIImageView *view_Im         


        
10条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-02 17:16

    I tested your url and found the issue.

    The issue is with this line:

    NSString *url_Img1 = @"http://opensum.in/app_test_f1/;";
    

    You are adding a ; at last of the url string.

    So when you concatinate two strings it'll look like: http://opensum.in/app_test_f1/;45djx96.jpg

    That is not a valid url.

    The correct url is : http://opensum.in/app_test_f1/45djx96.jpg

    Change the code like:

     NSString *url_Img1 = @"http://opensum.in/app_test_f1/";
    

    It'll work.

提交回复
热议问题