ios - Why does -[UIColor setFill] work without referring to a drawing context? -


it escapes me why code, inside drawrect:, works:

uibezierpath *buildingfloor = [[uibezierpath alloc] init]; // draw shape addlinetopoint [[uicolor colorwithred:1 green:0 blue:0 alpha:1.0] setfill]; // i'm sending setfill uicolor object? [buildingfloor fill]; // fills current fill color 

my point is, uicolor object gets message setfill , somehow stack understands uicolor fill color, isn't weird , wrong? @ least expect setting fill calling cgcontext method... instead of representing color, uicolor goes on , change context of drawing.

could explain happening behind scenes, because i'm totally lost here?

i did check out these references before posting:

http://developer.apple.com/library/ios/#documentation/uikit/reference/uicolor_class/reference/reference.html http://developer.apple.com/library/ios/#documentation/uikit/reference/uibezierpath_class/reference/reference.html

my point is, uicolor object gets message setfill , somehow stack understands uicolor fill color, isn't weird , wrong? @ least expect setting fill calling cgcontext method... instead of representing color, uicolor goes on , change context of drawing.

it because taking place within current cgcontext. why code works if there is current cgcontext (as there is, example, in drawrect: or in uigraphicsbeginimagecontextwithoptions block).

it lot, @ stage of ios study, read drawing chapter of book: http://www.apeth.com/iosbook/ch15.html#_graphics_contexts


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -