objective c - iOS Scale CGContextRef when underlying view bounds change -



objective c - iOS Scale CGContextRef when underlying view bounds change -

i'm using simple painting app tutorial basis:

http://www.effectiveui.com/blog/2011/12/02/how-to-build-a-simple-painting-app-for-ios/

on top of basics, able scale drawing board (keeping aspect ratio), leads size of cgcontext not matching size of frame, points touches detected, lines drawn, , view refreshed display lines not coincide more.

i tried scaling context using ratio of old frame new frame:

cgfloat ratio = oldframe.size.width / self.frame.size.width; cgcontextscalectm(cachecontext, ratio, ratio);

but must simplistic , not give desired result.

how can scale context in such way remains in sync underlying view , mapping of received touches?

ios objective-c cgcontext

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -