Search code examples
iosobjective-cuiviewavfoundationcalayer

How to make UIView with AVCaptureVideoPreviewLayer look better?


I'm trying to build a subclass of UIView to quickly take one snapshot by using AVFoundation. It's working great but I would really like to make the corners round or add a little shadow. How can I achieve this using Core Graphics etc.?

GitHub: https://github.com/dariolass/QuickShotView

Update: This is what the result looks like:

http://www.bytolution.com/qsv.png


Solution

  • Use QuartzCore

    #import <QuartzCore/QuartzCore.h>
    

    then you can modify the layer off your the view:

    someView.layer.cornerRadius = 8;
    someView.layer.shadowOffset = CGSizeMake(-15, 20);
    someView.layer.shadowRadius = 5;
    someView.layer.shadowOpacity = 0.5;
    

    or something like that