#import "ViewController.h"
#define WIDTH 50
#define PHOTO_HEIGHT 150
@interface ViewController () @end @implementation ViewController - (void)viewDidLoad
{
[super viewDidLoad];
CALayer *layer=[CALayer layer];
layer.bounds=CGRectMake(, , PHOTO_HEIGHT, PHOTO_HEIGHT);
layer.position=CGPointMake(, );
layer.backgroundColor=[UIColor redColor].CGColor;
layer.cornerRadius=PHOTO_HEIGHT/;
layer.masksToBounds=YES; layer.borderColor=[UIColor whiteColor].CGColor;
layer.borderWidth=;
layer.delegate=self;
[self.view.layer addSublayer:layer];
[layer setNeedsDisplay]; }
-(void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx
{
CGContextSaveGState(ctx);
CGContextScaleCTM(ctx, , -);
CGContextTranslateCTM(ctx, , -PHOTO_HEIGHT);
UIImage *image=[UIImage imageNamed:@""];
CGContextDrawImage(ctx, CGRectMake(, , PHOTO_HEIGHT, PHOTO_HEIGHT), image.CGImage);
CGContextRestoreGState(ctx);
}