I have a UIView in storyboard called _gameView and I've applied constraints on it in storyboard. it subclasses SKView so I can present my scene in it but the problem is that it never gets the contrains from autolayout in storyboard at runtime, why?
Asked
Active
Viewed 397 times
2 Answers
1
Sprite Kit scenes are presented by a special kind of UIView, SKView, and do not use Auto Layout. Only UIKit does - Auto Layout handles the arrangement of UIViews.

Harshal Bhavsar
- 1,598
- 15
- 35
-
So i should only use setframe: or setbounds to show them in my prefered place on the screen? Assuming i have an i-ad banner which i want it to be shown on the top of my skview. – Reza.Ab Feb 17 '16 at 18:07
-
1@Reza.ab yes. Go ahead . There will be no issues. – Harshal Bhavsar Feb 17 '16 at 18:16
-
So i did this, Doesnt work! it still gets shown in a view with full width but centered and cropped (not full screen) `SKView *skView1 = [[SKView alloc]initWithFrame:CGRectMake(40, 40, 100, 120)]; SKScene * scene = [IntroScene sceneWithSize:skView1.bounds.size]; scene.scaleMode = SKSceneScaleModeAspectFill; ` Seems like i cant set a custom frame for my SKView and show it in a prefered place on the screen,What am i doing wrong? – Reza.Ab Feb 17 '16 at 19:05
-
However i have tried doing this but the casted frame (someOtherView) also needs to be a skview which i cant define a frame for it using setFrame. `SKView * skView = (SKView*)someOtherView;` – Reza.Ab Feb 17 '16 at 19:11
0
Basically setting the Main.storyboard as lunchscreen in the project's target did the trick,Found the correct answer, it's a bug in ios9 with spritekit and can be solved this way iOS9 App has black bars on top and bottom