So... how do I add a RootViewController?
by Joe O · in iTorque 2D · 06/07/2012 (9:09 am) · 6 replies
I've been banging my head on iAds for the last few days. When I add the iAd banner as a subview I can't click on it, when I set the viewController's view to the iAd banner the layout gets completely horked but I can click on it just fine. Something is going on with the events and in some cases, if I setup the frame before I add the viewController to the window, all input is squashed except for clicking on the iAd. What's interesting in that case is it will let me click the ad, then I can click any of my other buttons after that first click.
I have a hunch it probably has something to do with the fact that we don't have a rootViewController. Has anyone successfully added a rootViewController to their project? I'd love to give it a test.
I have a hunch it probably has something to do with the fact that we don't have a rootViewController. Has anyone successfully added a rootViewController to their project? I'd love to give it a test.
#2
http://www.garagegames.com/community/blogs/view/21550
06/07/2012 (10:22 pm)
If you really need to add a rootViewController now (iOS 5) :http://www.garagegames.com/community/blogs/view/21550
#3
06/08/2012 (7:37 am)
Thanks Paul - I'll give it a go and see how it works out.
#4
Thanks again for sending the reference. I made all the changes and added the proper reference files to my project. I did run into one snag though...
Should I just create a TGBViewController in TGBAppDelegate and pass it into the function expecting it? Do I need to add the view controller to the window as a subview?
Apologies for the noob questions - I'm no expert in the iPhone UI bits.
[i]edit[i] I usually ask a question right before I do something... I think I've got a handle on this part, or at least how to get it to build...
But now I'm hitting some crazyness:
I did do a few things... such as this in TGBAppDelegate:
Any thoughts about where I went totally wrong? Thanks!
06/08/2012 (7:46 pm)
Hey Paul -Thanks again for sending the reference. I made all the changes and added the proper reference files to my project. I did run into one snag though...
Undefined symbols for architecture i386:
"_iPhoneRunTorqueMain(objc_object*, UIView*, UIApplication*)", referenced from:
-[TGBAppDelegate applicationDidFinishLaunching:] in TGBAppDelegate.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)Should I just create a TGBViewController in TGBAppDelegate and pass it into the function expecting it? Do I need to add the view controller to the window as a subview?
Apologies for the noob questions - I'm no expert in the iPhone UI bits.
[i]edit[i] I usually ask a question right before I do something... I think I've got a handle on this part, or at least how to get it to build...
But now I'm hitting some crazyness:
2012-06-08 19:58:31.090 RBMC[36813:1c403] -[GLKView setIsLayedOut:]: unrecognized selector sent to instance 0x9eadfd0 2012-06-08 19:58:31.093 RBMC[36813:1c403] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[GLKView setIsLayedOut:]: unrecognized selector sent to instance 0x9eadfd0' *** First throw call stack: (0x22f1022 0x34fccd6 0x22f2cbd 0x2257ed0 0x2257cb2 0x3639bc 0x101aa1e 0x327da5 0xf514be 0xf52274 0xf61183 0xf61c38 0xf55634 0x26ffef5 0x22c5195 0x2229ff2 0x22288da 0x2227d84 0x2227c9b 0xf51c65 0xf53626 0x333def 0x2bc5) terminate called throwing an exceptionsharedlibrary apply-load-rules all Current language: auto; currently objective-c++ (gdb) bt #0 0x9c0949c6 in __pthread_kill () #1 0x998d8f78 in pthread_kill () #2 0x998c9bdd in abort () #3 0x03a18e78 in abort_message () #4 0x03a1689e in default_terminate () #5 0x034fcf17 in _objc_terminate () #6 0x03a168de in safe_handler_caller () #7 0x03a16946 in std::terminate () #8 0x03a17b3e in __cxa_rethrow () #9 0x034fce15 in objc_exception_rethrow () #10 0x02227de0 in CFRunLoopRunSpecific () #11 0x02227c9b in CFRunLoopRunInMode () #12 0x00f51c65 in -[UIApplication _run] () #13 0x00f53626 in UIApplicationMain () #14 0x00333def in main (argc=1, argv=0xbffff5d4) at /path/Xcode_iPhone/../../../../engine/source/platformiPhone/iPhoneMain.mm:357
I did do a few things... such as this in TGBAppDelegate:
- (void)applicationDidFinishLaunching:(UIApplication *)application {
_iPhoneTorqueFatalError = false;
TGBViewController *view = [[TGBViewController alloc] init];
[window addSubview:view.view];
if(!_iPhoneRunTorqueMain( self, window, view ))Any thoughts about where I went totally wrong? Thanks!
#5
moved over to viewDidLoad in TGBViewController.
You won't need to alloc a TGBViewController, the storyboard should take care of that.
Looks like my readme.txt instructions are incomplete - theres TGBAppDelegate files that the readme doesn't tell you to use in there. Ugh. Must fix.
06/08/2012 (9:52 pm)
I've got the code block in applicationDidFinishLaunching_iPhoneTorqueFatalError = false;
if(!_iPhoneRunTorqueMain( self, window, application ))
{
_iPhoneTorqueFatalError = true;
return;
};moved over to viewDidLoad in TGBViewController.
You won't need to alloc a TGBViewController, the storyboard should take care of that.
Looks like my readme.txt instructions are incomplete - theres TGBAppDelegate files that the readme doesn't tell you to use in there. Ugh. Must fix.
#6
One thing I did notice though... It looks like the view does not completely fill the screen on the simulator. I just went into the storyboard and tweaked the simulated metrics on the GLKit View Controller. That seemed to do the trick :)
06/09/2012 (12:35 pm)
Thanks - that tip helped. I just need to figure out how to integrate my ad view controller now.One thing I did notice though... It looks like the view does not completely fill the screen on the simulator. I just went into the storyboard and tweaked the simulated metrics on the GLKit View Controller. That seemed to do the trick :)
Torque Owner John Vanderbeck
VanderGames
It essentially involves creating a new project with one, and migrating everything into it.