Image loading taking more time in swift

时光毁灭记忆、已成空白 提交于 2019-12-11 16:13:56

问题


I am working on an application, where I am loading some images from the server and showing it on table view using Alamofire. But the problem is it is taking so much time to load the image. I want to show the image, like a blurry image until the time image is not loading. Please, someone, help me.

 cell.profileImageView?.pin_setImage(from: URL(string: modelArray[indexPath.row]))

回答1:


This one is the solution using Kingfisher pod. You can set an activity Indicator while image is loaded.

 let imageUrl =  modelArray[indexPath.row]
    //set activity indicator until image is loaded
    cell.profileImageView?.kf.indicatorType = .activity
    if let url = URL(string: imageUrl) {
        let resource = ImageResource(downloadURL:  url)
        cell.profileImageView?.kf.setImage(with: resource)
    }


来源:https://stackoverflow.com/questions/58180243/image-loading-taking-more-time-in-swift

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!