CCScrollView抛出错误并导致崩溃

时间:2015-08-03 02:46:55

标签: ios swift cocos2d-iphone spritebuilder

目前,我正在以编程方式使用以下代码创建CCScrollView

func didLoadFromCCB() {
    self.userInteractionEnabled = true
    let contentNode = scrolling //scrolling is just a CCNode
    let scrollView = CCScrollView(contentNode: contentNode)
    scrollView.contentSizeType = CCSizeType(widthUnit: .Points, heightUnit: .Points)
    scrollView.contentSize = CGSizeMake(200, 200)
    let viewSize = CCDirector.sharedDirector().viewSize()
    scrollView.position = CGPoint(x: viewSize.width / 2.0, y: viewSize.height / 2.0)
    addChild(scrollView)
}

我收到此错误:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '[PROPERTY] contentNode - kCCBPropTypeCCBFile - Failed to find ccb file: ".ccbi", node class name: "CCScrollView", name: "", in ccb file: "MainScene.ccbi"'

如果我在sprite builder中添加滚动视图,也会发生同样的事情。有谁知道如何解决这一问题?好像我错过了滚动视图源文件。任何帮助是极大的赞赏!谢谢!

0 个答案:

没有答案