graphics - How do I create an onClick drawLine function in swift? -


i need create function make line connecting 2 buttons when pressed. however, way can figure out how create line predetermined start , endpoint.

func drawlinefrom(frompoint: cgpoint, topoint: cgpoint) {      uigraphicsbeginimagecontext(view.frame.size)     let context = uigraphicsgetcurrentcontext()      cgcontextsetlinewidth(context, 3.0) /* setting line width: set let , width next (let, width) */     cgcontextsetstrokecolorwithcolor(context, uicolor.purplecolor().cgcolor)      cgcontextmovetopoint(context, oldlocation.x, oldlocation.y)     cgcontextaddlinetopoint(context, newlocation.x, newlocation.y)      cgcontextstrokepath(context)     uigraphicsendimagecontext() } 

when call function, in class, testing, have figured out entire thing runs, , oldlocation , newlocation have appropriate values create line. however, no line created (or @ least not visible). there command neglecting run, or else problem?


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -