iOS 5: can't have subview to ARViewController anymore

Community support forum for the ARToolKit Professional v4.x for iOS SDK.

Moderator: ARToolKit developers

Forum rules
Ensure that any material you post to this forum complies with Apple's iOS SDK License terms.

iOS 5: can't have subview to ARViewController anymore

Postby mikewoz » Sat Oct 15, 2011 8:54 pm

Hi,

I finally tried building my app with the iOS 5 SDK, and have an issue with windows / subviews.

Previously, I added a overlay view to my scene in ARAppOSGDelegate's applicationDidFinishLaunching like this:
Code: Select all
[window addSubview:viewController.view];
[window addSubview:hudController.view];

Here viewController is an instance of ARViewController, and hudController is my custom class. This worked fine, but as of iOS 5, I see the hudController view for only a fraction of a second, then the screen flashes white and the AR view appears over top. It seems like this is triggered by [ARView layoutSubviews]. It somehow pops up to the front, and hided my subview.

Does anyone have any idea what changed in iOS 5 that would cause this?

---
Also, in case anyone is interested, there were 2 issues that prevented me from even getting my app to build for iOS 5 in the first place:

1) The GCC 4.2 compiler is no longer bundled with XCode, so you have to switch to LLVM GCC 4.2. I first tried the default Apple LLVM compiler, but got a segfault when loading OSG dynamic libraries (something to do with dynamic_cast).

2) I had to modify one of the OSG include files: include/ios4/osg/BufferObject lines 84,85:
Changed:
Code: Select all
        typedef int GLintptr;
        typedef int GLsizeiptr;

To:
Code: Select all
        typedef long GLintptr;
        typedef long GLsizeiptr;
mikewoz
 
Posts: 29
Joined: Fri May 07, 2010 9:31 pm

Re: iOS 5: can't have subview to ARViewController anymore

Postby mikewoz » Sun Oct 16, 2011 8:30 pm

Well, I found a hack to get around this. In [ARViewController start], I force the GL view to the back right after it's added:

Code: Select all
// look for this in ARViewController:
glView = [[ARView alloc] initWithFrame:[[UIScreen mainScreen] bounds] pixelFormat:kEAGLColorFormatRGBA8 depthFormat:GL_DEPTH_COMPONENT16_OES stencilFormat:0 preserveBackbuffer:NO];
glView.arViewController = self;
self.view = glView;

// Do this to force GL view behind my custom views:
[self.view.superview sendSubviewToBack:self.view];
mikewoz
 
Posts: 29
Joined: Fri May 07, 2010 9:31 pm


Return to ARToolKit for iOS

Who is online

Users browsing this forum: No registered users and 1 guest

cron