以下代码导致我的游戏崩溃..如果我将其注释掉,我根本没有问题..我真的看不出任何错误..我首先认为这可能是由内存问题引起的,但在我的dealloc 方法我正在释放视图和 webview.. 我做错了什么?
view = [[UIView alloc] initWithFrame:CGRectMake(0, self.boundingBox.size.width, self.boundingBox.size.width, self.boundingBox.size.height)];
NSString *urlAddress=@"http://www.google.com";
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLRequest *reqObject=[NSURLRequest requestWithURL:url];
webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, self.boundingBox.size.width, self.boundingBox.size.height )];
webView.delegate = self;
[webView loadRequest:reqObject];
[view addSubview:webView];
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button setImage:[UIImage imageNamed:@"ok-button"] forState:UIControlStateNormal];
[button addTarget:self
action:@selector(web)
forControlEvents:UIControlEventTouchDown];
[button setTitle:@"Show View" forState:UIControlStateNormal];
button.frame = CGRectMake(self.boundingBox.size.width - 40, 10, 30, 30.0);
[view addSubview:button];
[[[CCDirector sharedDirector] openGLView] addSubview:view];