objective c - How to implement the color wheel inside the UIView? -
i searched web site, , found how draw color wheel... math behind colour wheel
but implement drawing on uiview. how can using quartz technology? should draw dots or lines? thank you
maybe use you.
- cgcontext*** functions draw dots or lines, , uigraphicsgetimagefromcurrentimagecontext uiimage item.
-(void) drawpoint:(cgpoint)point { cgcontextbeginpath(uigraphicsgetcurrentcontext()); cgcontextmovetopoint(uigraphicsgetcurrentcontext(), point.x, point.y); cgcontextaddlinetopoint(uigraphicsgetcurrentcontext(), point.x, point.y); cgcontextstrokepath(uigraphicsgetcurrentcontext()); }
-(void) drawlinefrom:(cgpoint)start to:(cgpoint)end { cgcontextbeginpath(uigraphicsgetcurrentcontext()); cgcontextmovetopoint(uigraphicsgetcurrentcontext(), start.x, start.y); cgcontextaddlinetopoint(uigraphicsgetcurrentcontext(), end.x, end.y); cgcontextstrokepath(uigraphicsgetcurrentcontext()); }
- draw uiimage uiview. uicolor* backcolor = [uicolor colorwithpatternimage:your_image_from_cgcontext]; view.backgroundcolor = backcolor;
Comments
Post a Comment