uiview - Draw swipe with UIBezierPath in UIImageView -
i trying draw in uiimageview..i able draw without problems in uiview using following code:
@implementation drawview { uibezierpath *path; } - (id)initwithcoder:(nscoder *)adecoder { if (self = [super initwithcoder:adecoder]) { [self setmultipletouchenabled:no]; [self setbackgroundcolor:[uicolor whitecolor]]; path = [uibezierpath bezierpath]; [path setlinewidth:2.0]; } return self; } - (void)drawrect:(cgrect)rect { [[uicolor blackcolor] setstroke]; [path stroke]; } - (void)touchesbegan:(nsset *)touches withevent:(uievent *)event { uitouch *touch = [touches anyobject]; cgpoint p = [touch locationinview:self]; [path movetopoint:p]; } - (void)touchesmoved:(nsset *)touches withevent:(uievent *)event { uitouch *touch = [touches anyobject]; cgpoint p = [touch locationinview:self]; [path addlinetopoint:p]; // (4) [self setneedsdisplay]; } - (void)touchesended:(nsset *)touches withevent:(uievent *)event { [self touchesmoved:touches withevent:event]; } - (void)touchescancelled:(nsset *)touches withevent:(uievent *)event { [self touchesended:touches withevent:event]; }
this skips imageview.. need opposite. wanna draw in uiimageview , skip uiview.. how can that? in advance..
the drawing surface needs parent in hierarchy of view set. way can draw on parent view, while image lies underneath.
-main view --drawing view ---uiimageview
Comments
Post a Comment