ios - Unable to get view controller size. Swift -
ios - Unable to get view controller size. Swift -
i'm new swift , i'm trying utilize next method create skspritenode in gamescene.swift:
var longchainsaw = chainsawmaker.longchainsawcreator()
the problem need size of gamescene view chainsawmaker class. have in chainsawmaker.swift:
import spritekit class chainsawmaker: skscene { class func longchainsawcreator () -> skspritenode { //long chainsaw allow longchainsawwidth = size.width/3
the error occurs size.width/3 "chainsawmaker.type not have fellow member named size"
any recommendations?
that's because you're calling class func longchainsawcreator()
without having initiated instance of chainsawmaker
.
according documentation (https://developer.apple.com/library/ios/documentation/spritekit/reference/skscene_ref/index.html#//apple_ref/occ/instp/skscene/size), size
exists instance variable, not class variable
ios swift ios8 sprite-kit
Comments
Post a Comment