ios - How can i create curve UIView/UIImageView not with animation? -


how can create uiview looks , subview same effect. after searching in web found can done calayer, not have enough knowledge on . please me. in advance.

how

upto levels , understanding have done coding may helpful you.. if not please ignore it..

1st create custom view new file

next, need change class of viewcontroller's view property uiview our customview class. open mainstoryboard.storyboard , in document outline click on view icon. then, open identity inspector (option+command+3) , change class name customview.

then add code in custom view

- (void)drawrect:(cgrect)rect {   // drawing code   uiimage *imagerecipe =[uiimage imagenamed:@"statement_card_1.png"];   uiimageview *imgview = [[uiimageview alloc]initwithframe:cgrectmake(0 ,0 ,290, 200)];   imgview.image = imagerecipe;   [self addsubview:imgview];    cgpoint secondpoint = cgpointzero;   cgpoint point1 = cgpointzero;   cgpoint initial = cgpointzero;    uibezierpath *apath = [uibezierpath bezierpath];    initial = cgpointmake(30, 60);   [apath movetopoint:initial];    cgpoint point = cgpointmake(290, 60);   cgpoint centerpoint = cgpointmake(point.x/2, -10);    [apath addquadcurvetopoint:point controlpoint:centerpoint];     secondpoint = cgpathgetcurrentpoint(apath.cgpath);    [apath addlinetopoint:cgpointmake(secondpoint.x, 200.0)];    point1 = cgpathgetcurrentpoint(apath.cgpath);    cgpoint p = cgpointmake(initial.x,point1.y);   cgpoint cp = cgpointmake(point1.x/2 ,point1.y/2 + 30);    [apath addquadcurvetopoint:p controlpoint:cp];   [apath addlinetopoint:cgpointmake(initial.x, secondpoint.y)];  [apath closepath];   [apath stroke];   cashapelayer *masklayer = [cashapelayer layer];  masklayer.frame = imgview.bounds;  masklayer.path = apath.cgpath;  imgview.layer.mask = masklayer; } 

Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -