2014-09-11 55 views
0

我有这个在我的 “GameScene.m” 级(SKScene):电话方法 - iOS设备

GameViewController * game = [[GameViewController alloc] init]; 
[game imgMethod]; 

而且我在 “GameViewController.m”(UIViewController中)有这样的方法:

- (void)imgMethod{ 
    NSLog(@"test"); 
    img.alpha = 0.5; 
} 

而事情是打印出“测试”,但img.alpha = 0.5不起作用。我已经确定图片通过故事板链接,并且该行在viewDidLoad方法中起作用,但是我需要从我的GameScene类中调用它。任何方式来做到这一点?

回答

1

“测试” 被打印出来,但img.alpha = 0.5不起作用

这将在两种情况下发生。

  1. 当当忘记从SKSceneGameViewControllerimg属性分配(在GameViewController分配后)分配一个新的存储器,用于现有的对象(GameViewController