1

Currently I am programmatically creating a CCScrollView with this code:

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

I get this error:

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"'

The same thing happens if I add the scroll view in sprite builder. Does anyone know how to fix this? It appears as though I am missing the scroll view source file. Any help is greatly appreciated! Thanks!

YvesLeBorg
  • 9,070
  • 8
  • 35
  • 48
Kendel
  • 1,698
  • 2
  • 17
  • 33
  • It appears a file name is missing since it thinks the entire file name is ".ccbi". Did you fail to fill in an identifier somewhere in an initializer, or is there an error in MainScene.ccbi? Show your initialization code. – BaseZen Aug 03 '15 at 03:29
  • My initialization for what? The scene? Also, I was wondering if this is related to https://github.com/spritebuilder/SpriteBuilder/issues/410 – Kendel Aug 03 '15 at 05:20
  • Are you sure that you've removed the scrollview in SB and re-published? Because the error looks like it's coming from SB. It shouldn't happen when the scrollview is created in code. That's my guess away from the mac anyway. – Pontus Armini Aug 03 '15 at 10:20
  • Yeah I know it is for sure not SB because if I comment out the code, the rest runs fine with no error. – Kendel Aug 03 '15 at 14:26

0 Answers0