0

I am trying to call a viewcontrollerB from a viewcontrollerA with the following code:

ViewControllerB *vc = [[ViewControllerB alloc]initWithNibName:nil bundle:nil];
[self presentViewController:vc animated:YES completion:nil];

Within the viewcontrollerB I have the following code:

SKView * skView = (SKView *)self.view;

skView.showsFPS = NO;
skView.showsNodeCount = NO;

// Create and configure the scene.
SKScene * scene = [MainScene sceneWithSize:skView.bounds.size];
//scene.scaleMode = SKSceneScaleModeAspectFit;

// Present the scene.
[skView presentScene:scene]; 

I receive the error:

[UIView setShowsFPS:]: unrecognized selector sent to instance

So I have read and implemented the solution wrote in the following link:

Simple Sprite Kit Scene setup going wrong

But I have the same error.

Community
  • 1
  • 1
wrynux
  • 23
  • 5

2 Answers2

1

When you do this...

SKView * skView = (SKView *)self.view;

skView.showsFPS = NO;

...you're telling the compiler that your view is a SKView but apparently it's not. The error message says that it's a plain UIView. You need to look at how a MSPageViewControllerB is defined and what type of object its view property is defined as being.

Phillip Mills
  • 30,888
  • 4
  • 42
  • 57
0

I have solved with the following code:

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main_iPhone" bundle:nil];
ViewControllerB *viewController = [storyboard instantiateViewControllerWithIdentifier:@"ViewControllerB"];
[self presentViewController:viewController animated:YES completion:nil];
wrynux
  • 23
  • 5