http://code.google.com/p/encuadro/wiki/isgl3d_and_Storyboard
On this page, it is explained how to integrate a simple isgl3d app with a storyboard
Introduction
ISGL3D is a powerful tool with which you can very easily create rendering applications. On the other side xcode has already a lot of work done regarding user interface. So it is something very common that people that are starting using both xcode and isgl3d want to integrate the rendering made with ISGL3D part with a UInterface made with Storyboard. On this page, it is explained how to integrate both things in a simple app.
At the end of this tutorial you will be able to have a simple app in which the main menu is a UIViewcontroller with a UIButton that segues to a Isgl3dViewcontroller view that has the default Helloworldview.
Step by step
Create a new isgl3d Application
On the AppDelegate on the applicationDidFinishLaunching method, you need to comment the window´s allocation and the viewController to be visible.
// Create the UIWindow
// _window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Add view to window and make visible
// [_window addSubview:_viewController.view];
// [_window makeKeyAndVisible];
You also may pause or end the Isgl3dDirector:加在applicationDidFinishLaunching最后
[[Isgl3dDirector sharedInstance] end];
Create a Storyboard and a new Objective-C of type UIViewController
You now have to create a Storyboard and a new UIViewController subclass of type UIViewController (may also be whatever you want: UITableViewController, for exapmple). On this new UIViewController class that I called VistaViewController you have to implement two IBActions that I called hacerRender to change from storyboard to the isgl3dViewController and buttonClicked that permits you to go back from the render to the storyboard.再次你要在storyboard上加上一个按钮与hacerRender事件关联。
- (IBAction)hacerRender:(id)sender
On this IBAction I basically initialize the same thing as the default application does in order to have a rendering view. If you compare this with the default application you will realize that it is pretty much the same, creating the window, seting the view in the director, adding the glview as a subview and so on. I also added programmatically the view of a button and associated it to a selector (the other IBAction), that is the action that is going to be performed by clicking on this button.
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchDown];
- (IBAction)buttonClicked:(id)sender
Here I pretty much release the window and allocate it again. Then I have to tell the controller to load the view I have on the Storyboard, by adding the following code:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Storyboard" bundle:nil];
VistaViewController *mainViewController = [storyboard instantiateInitialViewController];
self.window.rootViewController = mainViewController;
Finally I have to end the Isgl3dDirector (if not, you will have multiple instances of the rendering):
[[Isgl3dDirector sharedInstance] end];
GitRep
Here it is available the source code if you want to see more in detail.http://code.google.com/p/encuadro/source/browse/#git%2Fxcode%2FDEMO%2Fprueba_story_isgl%2Fprueba1%2Fprueba