I am getting URL images from API. I have stored the UR images into string. Here my problem I want to display that into carousel. I don't know how to do this. Below is my code that I have tried.
for(int i=0;i<hotelIMAges.count;i++ )
{
NSDictionary *images=[hotelIMAges objectAtIndex:i];
NSString *Images= [images objectForKey:@"Imagepath"];
[ImageARRAy addObject:Images];
} //Here I have stored all the images into string..(https://***.jpg)
Carousel *carousel = [[Carousel alloc] initWithFrame:CGRectMake(0, 0,300, 262)];
[carousel setImages:ImagesARRAy];
You just need to process asynchronously as your current approach can be a synchronous request and blocks the main thread until that download is complete.
Consider using
SDWebImageand theUIImageViewextension it adds to manage the image download and display. It also supports a placeholder image that you can supply to indicate that the download is in progress.If your using any third party carousel check for asynchronous methods to display the images.I believe
setImages: method must be for images that are stored locally inside app. Do let me know if you have any queries.----EDITED----
Your Carousel is using synchronous method to display which blocks the main thread. You can use SDWebImage for your purpose. For this you need to download SDWebImage for asynchronous downloading of image. You can download SDWebImage from link below. You can use it in your Carousel.h class as
modify your setup method with below line.
For details refer github page of SDwebpage. DO let me know if you have any queries. https://github.com/rs/SDWebImage#using-asynchronous-image-downloader-independently