混乱SKView和NSVew在Cocoa应用程序中遇到麻烦

时间:2014-09-19 17:03:38

标签: objective-c cocoa variables nsview skview

在我的项目中,我将SKView与标准NSView对象混合在一个窗口中。现在我尝试从SKscene(mouseDown位置)获取一些信息,并在skview对象附近的标签中显示它。 我尝试使用全局变量并在skview方法

中为其赋值
-(void)mouseDown:(NSEvent *)theEvent{
   CGPoint location = [theEvent locationInNode:(self)];  
  // location = (10, 15) - example
   currentPointPosition = CGPointMake(location.x, location.y); 
  //currentPointPosition = (10, 15)
}

但是从nsbutton检查时,就像这样:

- (IBAction) updateButton:(id)sender {
  NSLog(@"currentPoint over skview methods: 
  %0.3f : %0.3f", currentPointPosition.x, currentPointPosition.y);
  //currentPointPosition = (0, 0)
  //other code
}

......它仍然像在init(annul)之后。
甚至可以混合使用这些技术吗?
ps:对不起我的英语
Project screen: http://s8.postimg.org/kdmu36h6d/2014_09_19_20_02_30.png

0 个答案:

没有答案