无法从KASlideShow pod加载图像 [英] Cannot load images from KASlideShow pod

查看:82
本文介绍了无法从KASlideShow pod加载图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是从Swift和IOS开发开始,所以我认为我缺少明显的东西来使Pod正常工作

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

我正在将可可豆用于KASlideShow:<我的Swift项目中的a href = https://github.com/kirualex/KASlideShow rel = nofollow> https://github.com/kirualex/KASlideShow 。可可豆荚使我能够构建简单的幻灯片

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

我似乎已正确加载了豆荚,因为我可以访问目标ViewController中的方法并实例化对象

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

这是目标ViewController中的代码

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.
}

任何想法?

推荐答案

啊哈!

我现在正在使用它。我只是想念一个addSubView调用。因此,这一行显示了幻灯片显示

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

        self.view.addSubview(ss)

这篇关于无法从KASlideShow pod加载图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆