So whenever I have this:
let result = SKScrollingNode(color: UIColor.clearColor(), size:CGSizeMake(CGFloat(containerWidth), image.size.height));
I get a compilation error for the image.size.height, telling me that "'UIImage?' does not have a member named 'size' although it does
Any idea what this means and how to fix it?
Thanks!
Entire code fragment:
class func scrollingNode(imageNamed: String, containerWidth: CGFloat) -> SKScrollingNode {
let image = UIImage(named: imageNamed);
let result = SKScrollingNode(color: UIColor.clearColor(), size: CGSizeMake(CGFloat(containerWidth), image.size.height));
result.scrollingSpeed = 1.0;
var total:CGFloat = 0.0;
while(total < CGFloat(containerWidth) + image.size.width!) {
let child = SKSpriteNode(imageNamed: imageNamed);
child.anchorPoint = CGPointZero;
child.position = CGPointMake(total, 0);
result.addChild(child);
total+=child.size.width;
}
return result;