objective c - Need help to make own coordinate system (classic, center of UIView is 0,0) -
i need create own coordinate system in uiview, 0,0 center of uiview. don't know ho this. please help.
uiview *view = /*...*/; cgcontextref ctx = /*...*/; /* shift center ul corner mid-x, mid-y. */ cgrect bounds = [view bounds]; cgfloat hx = bounds.size.width / 2.0; cgfloat hy = bounds.size.height / 2.0; cgcontexttranslatectm(ctx, hx, hy); /* y still increases down, , x right. */ /* if want y increase up, flip y: */ cgcontextscalectm(ctx, 1.0/*sx*/, -1.0/*sy*/);
Comments
Post a Comment