如题,自己使用template建了一个helloworld项目,里面给建了RootViewController.h/m,我自己建了一个RootViewControll.nib文件。在AppController.mm中已经修改如下:
viewController = initWithNibName:@“RootViewController” bundle:nil];
同时 在RootViewController.mm中也修改至如下:
#import “RootViewController.h”
#import “ViewController.h”
@implementation RootViewController
// The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if ((self = )) {
// Custom initialization
}
return self;
}
// Implement loadView to create a view hierarchy programmatically, without using a nib. - (void)loadView {
;
}
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad {
;
}
// Override to allow orientations other than the default landscape orientation.
-
(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return UIInterfaceOrientationIsLandscape( interfaceOrientation );// switch to this line if you want to set portrait view
// return UIInterfaceOrientationIsPortrait( interfaceOrientation );
} -
(void)didReceiveMemoryWarning {
// Releases the view if it doesn’t have a superview.
;// Release any cached data, images, etc that aren’t in use.
} -
(void)viewDidUnload {
;
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
} -
(void)dealloc {
;
}
@end
我在RootViewController.nib中加入了一个label。我运行程序,但是看不到这个label,我看到的还是那个helloWorld的scence,我尝试按照cocos2d的方式
.view addSubView:self.view];
在loadView中加入
cocos2d::CCDirector::getEGLView()->…但是后面的我不知道如何写了。看了对应的cpp文件,也没找到对应的调用接口。
我这里先谢谢大家了哈!@