Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the first image never show up even though the download image is already finished #17

Open
AgungLaksana opened this issue Aug 21, 2018 · 1 comment

Comments

@AgungLaksana
Copy link

AgungLaksana commented Aug 21, 2018

so the first image in the array will never show up, except if I change to the page control 2 (index 1), and goes back to the page control 1 (index 0) then the image is eventually show up

here is the .gif file of my problem:
http://g.recordit.co/EdK3BzgCCj.gif

even if I use the image in the asset, the problem is still there

the pod I use

# Uncomment the next line to define a global platform for your project
 platform :ios, '9.0'

target 'AATheCorousel' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for AATheCorousel
pod 'AACarousel'
pod 'Kingfisher', '~> 4.0'

end

and here is the code I use


import UIKit
import AACarousel
import Kingfisher

class ViewController: UIViewController, AACarouselDelegate {
   
    
    
    @IBOutlet var corouselView: AACarousel!
    

    var titleArray = [String]()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        let pathArray = ["http://www.conversion-uplift.co.uk/wp-content/uploads/2016/09/Lamborghini-Huracan-Image-672x372.jpg",
                         "https://ak.picdn.net/assets/cms/97e1dd3f8a3ecb81356fe754a1a113f31b6dbfd4-stock-photo-photo-of-a-common-kingfisher-alcedo-atthis-adult-male-perched-on-a-lichen-covered-branch-107647640.jpg",
                         "https://imgct2.aeplcdn.com/img/800x600/car-data/big/honda-amaze-image-12749.png",
                         "http://www.conversion-uplift.co.uk/wp-content/uploads/2016/09/Lamborghini-Huracan-Image-672x372.jpg",
                         "https://imgct2.aeplcdn.com/img/800x600/car-data/big/honda-amaze-image-12749.png"]
        titleArray = ["picture 1","picture 2","picture 3","picture 4","picture 5"]
        corouselView.delegate = self
        corouselView.setCarouselData(paths: pathArray,  describedTitle: titleArray, isAutoScroll: false, timer: 5.0, defaultImage: "defaultImage")
        
        //optional methods
        corouselView.setCarouselOpaque(layer: false, describedTitle: false, pageIndicator: false)
        corouselView.setCarouselLayout(displayStyle: 0, pageIndicatorPositon: 2, pageIndicatorColor: nil, describedTitleColor: nil, layerColor: nil)
    }
    
    func didSelectCarouselView(_ view: AACarousel, _ index: Int) {
        
    }
    
    func callBackFirstDisplayView(_ imageView: UIImageView, _ url: [String], _ index: Int) {
        
    }
    
    func downloadImages(_ url: String, _ index: Int) {
        //here is download images area
        
        
        let imageView = UIImageView()
        imageView.kf.setImage(with: URL(string: url)!, placeholder: nil, options: nil, progressBlock: nil) { (downloadImage, error, cache, url) in
            self.corouselView.images[index] = downloadImage!
        }
        
        
        
        
    }

   

}
@bthereioan
Copy link

Inside your code add:
func callBackFirstDisplayView(_ imageView:UIImageView, _ url:[String], _ index:Int) {
imageView.image = UIImage.init(named:"step1_new")
}
where step1_new in the name of your first image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants