ios - UIBezierPath not drawing a smooth curve -
i using uibezierpath drawing, , have written code on touch events , working fine, curves not smooth, when move finger around , draw curve, not smooth.
- (void)drawrect:(cgrect)rect { [[uicolor redcolor] setstroke]; (uibezierpath *_path in patharray) [_path strokewithblendmode:kcgblendmodenormal alpha:1.0]; } #pragma mark - touch methods -(void)touchesbegan:(nsset *)touches withevent:(uievent *)event { mypath=[[uibezierpath alloc]init]; mypath.linewidth=5; mypath.linecapstyle = kcglinecapround; mypath.flatness = 0.0; uitouch *mytouch=[[touches allobjects] objectatindex:0]; [mypath movetopoint:[mytouch locationinview:self]]; [patharray addobject:mypath]; } -(void)touchesmoved:(nsset *)touches withevent:(uievent *)event { uitouch *mytouch=[[touches allobjects] objectatindex:0]; [mypath addlinetopoint:[mytouch locationinview:self]]; [self setneedsdisplay]; }
here image
in above image if see letters , d see curve not smooth. should do, smooth curve?
just use line. solve problem mypath.miterlimit=-10;
.
change value if need thing takes float value
Comments
Post a Comment