Log in or register to post comments

hoW to show UIButton?

December 8, 2012 - 11:06pm #1

I want to show button and label when trackable was detected( when 3d object appears)?

how to do it?

where I should place this code?

 

OverlayButtonLabel *obl = [[OverlayButtonLabel alloc] init];
        [parentView addSubview:obl];

hoW to show UIButton?

December 10, 2012 - 3:46am #2

Hi Yumugee

If you look at the ARParentViewController.mm file in Image Targets it shows how the existing overlay view (with buttons) gets displayed:

 

// touch handlers

 

- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event

 

{

 

    UITouch* touch = [touches anyObject];

 

    

 

    if (1 == [touch tapCount])

 

    {

 

        // Show camera control action sheet

 

        [overlayViewController showOverlay];        

 

    }

 

}

 

So one thing you could do is reuse the code in showOverlay() to display your buttons/labels rather than the ones shown in the sample.

You would most likely need to call this from EAGLView.mm in renderFrameQCAR, somewhere within this loop that iterates through the trackables every frame:

 

for (int i = 0; i < state.getNumActiveTrackables(); ++i)

 

However you might need to implement some type of state that checks the names of the trackables (see the image targets for an example) to avoid multiple calls to your UI code.

Hope this makes sense (and helps)

N

Log in or register to post comments