I have this in my "GameScene.m" class (SKScene):
GameViewController * game = [[GameViewController alloc] init];
[game imgMethod];
And I have this method in my "GameViewController.m" (UIViewController):
- (void)imgMethod{
NSLog(@"test");
img.alpha = 0.5;
}
And the thing is that the "test" is printed out, but the img.alpha = 0.5 doesn't work. I've made sure that the image is linked through the storyboard and that line works in the viewDidLoad method, but I need to call it from my GameScene class. Any way to do this?
"test" is printed out, but the img.alpha = 0.5 doesn't work
This will happen in two cases.
When you allocate a new memory for an existing object ( GameViewController
)
When you forgot to assign the GameViewController
img
property from the SKScene
class (after the GameViewController
allocation).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.