Monday, 15 March 2010

ios - Why does drawRect get called when I set a rotation transform in OSX? Shouldn't this be in hardware? -



ios - Why does drawRect get called when I set a rotation transform in OSX? Shouldn't this be in hardware? -

i've noticed pretty odd difference between how calayers seem respond transforms on osx , ios. on ios if apply rotation transform uiview drawrect not called, view transformed in hardware , displayed on screen. on osx if apply rotation transform nsview drawrect called every time. here code nsview:

- (instancetype) initwithframe:(nsrect)framerect { self = [super initwithframe:framerect]; if (self) { self.wantslayer = yes; self.layercontentsredrawpolicy = nsviewlayercontentsredrawduringviewresize; } homecoming self; } - (void) drawrect:(nsrect)dirtyrect { [[nscolor redcolor] setfill]; [[nsbezierpath bezierpathwithrect:dirtyrect] fill]; nslog(@"inside drawrect"); }

my question why drawrect called on osx not on ios? don't want called during rotation because draw expensive.

ios osx cocoa-touch cocoa calayer

No comments:

Post a Comment