iphone - How to draw a triangle programmatically -


i have triangle solver, want way use values answer draw triangle screen matches it.

if subclass uiview can implement in drawrect draw triangle:

-(void)drawrect:(cgrect)rect {     cgcontextref ctx = uigraphicsgetcurrentcontext();      cgcontextbeginpath(ctx);     cgcontextmovetopoint   (ctx, cgrectgetminx(rect), cgrectgetminy(rect));  // top left     cgcontextaddlinetopoint(ctx, cgrectgetmaxx(rect), cgrectgetmidy(rect));  // mid right     cgcontextaddlinetopoint(ctx, cgrectgetminx(rect), cgrectgetmaxy(rect));  // bottom left     cgcontextclosepath(ctx);      cgcontextsetrgbfillcolor(ctx, 1, 1, 0, 1);     cgcontextfillpath(ctx); } 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -