Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to make Irregular shape uiview and put uiimageview inside those shapes like instacollage iphone app

I am working on a photo collage iphone app and i have to make irregular shape photo frames inside each shape there will be a uiimageview with gestures, on tapping the shape i need to pick a photo for that shape, these frames are very similar to frames of instacollage iphone app. link : https://itunes.apple.com/in/app/instacollage-pro-pic-frame/id530957474?mt=8

provide me some kind of direction how to do this task.

Thanks

like image 490
Himanshu Yadav Avatar asked Nov 01 '12 05:11

Himanshu Yadav


1 Answers

You can use Mask property of the layer to achieve this.

CAShapeLayer *maskLayer = [CAShapeLayer layer];
maskLayer.frame = self.imageView.bounds ;
UIBezierPath *roundedPath = [UIBezierPath bezierPathWithOvalInRect:maskLayer.frame];
maskLayer.fillColor = [[UIColor whiteColor] CGColor];
maskLayer.backgroundColor = [[UIColor clearColor] CGColor];
maskLayer.path = [roundedPath CGPath];

// Add mask
self.imageView.layer.mask = maskLayer;
like image 129
Sahana Kini Avatar answered Sep 29 '22 10:09

Sahana Kini