Cannot load images from KASlideShow pod

时光毁灭记忆、已成空白 提交于 2019-12-12 03:22:41

问题


Im just starting out with Swift and IOS development so I think Im missing something obvious to make the pod below work

I am using the cocoa pod for KASlideShow : https://github.com/kirualex/KASlideShow in my Swift Project. The cocoa pod enables me to build an easy slideshow

I seemed to have loaded the pod correctly since I can access the methods and instantiate objects in my target ViewController

However I can't get the actual images to load, and I seemed to have covered all the steps necessary to get it to start a slideshow

Here's the code from my target ViewController

class SShowViewController: UIViewController, KASlideShowDelegate {



override func viewDidLoad() {
    super.viewDidLoad()

    let ss = KASlideShow(frame: CGRectMake(0, 0, 320, 250))
    ss.delegate = self
    ss.delay = 3
    ss.transitionDuration = 1
    ss.transitionType = KASlideShowTransitionType.Slide
    ss.imagesContentMode = UIViewContentMode.ScaleAspectFill
    ss.addImagesFromResources(["cat.jpeg", "oldyoung.jpg"])
    ss.start()
    print("Slidshow over?")
    // Do any additional setup after loading the view.
}

Any ideas??


回答1:


Aha!

I have it working now. I was just missing a addSubView call. So this one line brings up the slideshow

        self.view.addSubview(ss)


来源:https://stackoverflow.com/questions/33309418/cannot-load-images-from-kaslideshow-pod

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