문제

I have a ViewController in which i present my SKScene. So before i present the SKScene i use the UIImagePickerController in the ViewController to take a picture and in the

-imagePickerController:didFinishPickingMediaWithInfo:

when the UIImagePickerController dismiss i start to present the scene and initialize it :

[self dismissViewControllerAnimated:NO completion:nil];
    SKView * skView = (SKView *)self.view;
    skView.showsFPS = NO;
    skView.showsNodeCount = NO;

    // Create and configure the scene.
    MultiplayerScene * scene = [[MultiplayerScene alloc]initWithSize:self.view.frame.size andPicture:self.imageView];
    scene.scaleMode = SKSceneScaleModeAspectFill;
    // Present the scene.

    // --This works also just on the Simulator and not on Physical Device
    [scene setBackgroundColor:[UIColor redColor]];
    // --
    [skView presentScene:scene]; 

So, what happened in the Simulator it seems to work my Image is showing on the Screen,, but on physical device the picker dismiss and i see just the gray Background.

I have tried 2 Days to fix this but i actually i think that the problem is that the SKScene isn't first responder or will not initialize correct, but when i debug on the physical device the picture comes correct. The Same Problem will be produce with any type of Picker / Browser. On the GrayBackground (the default color for SKScene) the touch-events are working What can i do here to handle it right?

Best Konstantin

SOLVED Today i update my Xcode to 5.1 and then everything works fine (head meets table)...
Thanks for Mc.Lover for his clear answer!!

도움이 되었습니까?

해결책

Do something like this :

- (void)myMethod {

    MultiplayerScene * scene = [[MultiplayerScene alloc]initWithSize:self.view.frame.size andPicture:self.imageView];
    scene.scaleMode = SKSceneScaleModeAspectFill;

    [skView presentScene:scene]; 
}

[self dismissViewControllerAnimated:NO completion: ^ {[self myMethod]; }];

hope this helps !

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top