How to display a button above a QTCaptureView?
-
05-07-2021 - |
Question
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
OTHER TIPS
Like Davyd said, NSButton has nothing to do with CALayer How do you try to change the frame of the QTCaptureView? Please post code
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow