1

BWalkthrough 库链接:https ://github.com/ariok/BWWalkthrough

我是 iOS 开发新手(Swift 2.2、Xcode 7.3.1)。我已经使用库 BWWalkthrough 为我的应用程序工作。加载演练页面(BWWalkthroughPageViewController 类)时,我想在每个页面上自动播放视频。目前,我可以使用主故事板中的视图场景为演练页面添加图像、标签、按钮等,但是如何将视频添加到这些页面?我应该为每个页面创建“XViewController.swift”文件以编程方式添加视频吗?但是如何将这些文件与演练页面链接?目前,页面被添加到演练中:

@IBAction func openInstrButtonPressed(){

    let stb = UIStoryboard(name: "Main", bundle: nil)
    walkthrough = stb.instantiateViewControllerWithIdentifier("container") as! BWWalkthroughViewController
    let page_one = stb.instantiateViewControllerWithIdentifier("instr_page1")
    let page_two = stb.instantiateViewControllerWithIdentifier("instr_page2")
    let page_three = stb.instantiateViewControllerWithIdentifier("instr_page3")
    let page_four = stb.instantiateViewControllerWithIdentifier("instr_page4")

    // Attach the pages to the master
    walkthrough.delegate = self
    walkthrough.addViewController(page_one)
    walkthrough.addViewController(page_two)
    walkthrough.addViewController(page_three)
    walkthrough.addViewController(page_four)

    self.presentViewController(walkthrough, animated: true) {
        ()->() in
        self.needWalkthrough = false
    }
}

由于演练页面使用“BWWalkthroughPageViewController”类,我应该定义一个新类以编程方式添加视频吗?

4

1 回答 1

0

当然,这是唯一的方法,创建一个新类,如果你喜欢在(例如故事板)中创建一个视图并添加你的视频。我希望有用。

OBS:如果你知道如何编辑 BWWalkthroughPageViewController 的类,你可以创建一个特定的修改来导入视频。

于 2016-08-09T17:36:19.140 回答