I have this array of names as below
["Acting Chief Justice Gita Mittal", "Justice S. Ravindra Bhat", "Justice Sanjiv Khanna", "Justice GS Sistani", "Justice Dr. S. Muralidhar", "Justice Hima Kohli", "Justice Vipin Sanghi", "Justice Siddharth Mridul", "Justice Manmohan"]
and Array of URLs as below
["writereaddata%5Cupload%5CJudges/JImage_7ZV0X5SB.JPG", "writereaddata%5Cupload%5CJudges/JImage_31PR55RK.JPG", "writereaddata%5Cupload%5CJudges/JImage_TALSLWYH.JPG", "writereaddata%5Cupload%5CJudges/JImage_DDW7F8I4.JPG", "writereaddata%5Cupload%5CJudges/JImage_8MP3TXZ2.JPG", "writereaddata%5Cupload%5CJudges/JImage_3R72I03Q.JPG", "writereaddata%5Cupload%5CJudges/JImage_ZPL72GGF.JPG", "writereaddata%5Cupload%5CJudges/JImage_RHXYPY1N.JPG", "writereaddata%5Cupload%5CJudges/JImage_BR82DUAU.JPG"]
I want to display these in collection view in swift on runtime on image and label . How to do this ?
Thanks
There is a great swift library for downloading and caching images called SDWebImage . Check the docs it's pretty straightforward.
You can SDWebImage library to load image from URL
in TableView and CollectionView.
You like this in UITableView
and UICollectionView
cell.
cell.imageView.sd_setImage(with: URL(string: "yourImageURL"), placeholderImage: UIImage(named: "placeholder.png"))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.