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

Popular posts from this blog

php - How to pass multiple values from url -

database - php search bar when I press submit with nothing in the search bar it shows all the data -

ios - How to load .png images from Documents folder of an app -