Search code examples
objective-cxcodemacoscocoaquicktime

How to display a button above a QTCaptureView?


How can i display a button above a QTCaptureView? I have tried to put a button above the QTCaptureView on IB but when i run it, after the QTCaptureView starts showing the iSight camera image, the button hides behind the QTCaptureView...


Solution

  • Try to set setWantsLayer:YES in IB to both QTCaptureView and NSButton. Not layer based views don't support overlapping.

    Then after the xib is loaded the order may be not correct, so do in awakeFromNib:

    - (void)awakeFromNib
    {
      [self addsubview:qtView]
      [self addsubview:button]
    }
    

    I am not sure if it will help, but it should help. I had answer a similar question here