首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >BWWWalkthroughController在iOS中的铸造误差

BWWWalkthroughController在iOS中的铸造误差
EN

Stack Overflow用户
提问于 2015-06-28 22:35:04
回答 1查看 375关注 0票数 3

我正在尝试使用开源框架iOS BWWWalkthroughController (链接:https://github.com/ariok/BWWalkthrough)为我的BWWWalkthroughController应用程序创建一个自定义演练,但我无法让它工作!

下面是发生错误的类:

代码语言:javascript
复制
import UIKit

class StartPageViewController: UIViewController, BWWalkthroughViewControllerDelegate {

override func viewDidLoad() {
    super.viewDidLoad()
}

override func viewDidAppear(animated: Bool) {
    super.viewDidAppear(animated)

    let userDefaults = NSUserDefaults.standardUserDefaults()

    if !userDefaults.boolForKey("walkthroughPresented") {

        showWalkthrough()

        userDefaults.setBool(true, forKey: "walkthroughPresented")
        userDefaults.synchronize()
    }
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
}

@IBAction func showWalkthrough(){

    // Get view controllers and build the walkthrough
    let stb = UIStoryboard(name: "Walkthrough", bundle: nil)

让演练= as!BWWalkthroughViewController <-这是发生错误的地方

代码语言:javascript
复制
    let page_zero = stb.instantiateViewControllerWithIdentifier("walk0") as! UIViewController
    let page_one = stb.instantiateViewControllerWithIdentifier("walk1") as! UIViewController
    let page_two = stb.instantiateViewControllerWithIdentifier("walk2")as! UIViewController

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

    self.presentViewController(walkthrough, animated: true, completion: nil)
}


// MARK: - Walkthrough delegate -

func walkthroughPageDidChange(pageNumber: Int) {
    println("Current Page \(pageNumber)")
}

func walkthroughCloseButtonPressed() {
    self.dismissViewControllerAnimated(true, completion: nil)
}

}

以下是我的错误:

代码语言:javascript
复制
2015-06-29 00:24:02.951 Up & Down - Minimalistic, Beautiful Counter[13041:715011] Unknown class _TtC43Up & Down - Minimalistic, Beautiful Counter27BWWalkthroughViewController in Interface Builder file.
Could not cast value of type 'UIViewController' (0x10570c418) to 'Up___Down___Minimalistic__Beautiful_Counter.BWWalkthroughViewController' (0x103972fb0).
(lldb) 

我确保所有的类在IB中都有正确的名称,而且我确信所有的类都是正确链接的(插座、操作等等)。(我也看过许多相似的问题,没有答案。)有什么问题吗?谢谢!

EN

回答 1

Stack Overflow用户

发布于 2015-06-29 10:02:54

问题可能是Xcode中的一个bug --我的“was”视图控制器属于IB中的BWWalkthroughViewController类,但Xcode一直告诉我并非如此。最后,我删除了视图控制器,并做了一个新的,这是有效的。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31105449

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档