jeudi 18 septembre 2014

SpriteKit (iOS) addSubview (UIWebView) and remove it from SKScene


Vote count:

0




in my WelcomeScene.m i want to place a UIWebView, so thats no problem. I implement this function:



-(void) didMoveToView:(SKView *)view{

[super didMoveToView:view];

webView = [[UIWebView alloc] initWithFrame:CGRectMake(10, 10, 110, 300)];
webView.delegate = self;
NSURL *url = [NSURL URLWithString:@"http://www.test.de];
NSURLRequest* request = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:60.0];
[webView loadRequest:request];
[self.view addSubview:webView];


}


Until now there is no issue. But if i switch to the "Main Game Scene", the Webview is already there. I want to remove the UIWebView.


When i click on my "play"-button in the WelcomeScene i use the following code:


[webView removeFromSuperview]; ...However, the app crashes.


what did i wrong? I'm looking forward to your answers!



asked 15 secs ago







SpriteKit (iOS) addSubview (UIWebView) and remove it from SKScene

Aucun commentaire:

Enregistrer un commentaire