ios - Reflecting UIView changes after drawing -


how can reflect uiview changes of setneedsdisplay?

in drawrect triggered setneedsdisplay

- (void)drawrect:(cgrect)rect {    double = 0;    for(...)    //i incremented        dispatch_after(dispatch_time(dispatch_time_now, (int64_t)(i * nsec_per_sec)), dispatch_get_main_queue(), ^{                 drawstuff(element, context);        }); 

for example, each draw update happen after 1s, 2s, 3s, ...

drawstuff switches main thread

dispatch_async(dispatch_get_main_queue(), ^(void) { ... 

when updating ui. have tried both uibezierpath , core graphics , same results. using uigraphicspushcontext , uigraphicspopcontext correct context.

using nslog, can tell drawstuff called in 1s increments. however, visible uiview remains unchanged. can rotate device screen , reposition uiview , change size. on rotation uiview reflect has drawn, need rotate again see updated state after few seconds.

back question above, there call tell uiview display current graphics after setneedsdisplay? thanks.

if trying make sure view redrawn once per second, right way set form of timer elsewhere in view, , have timer function call -setneedsdisplay. in turn invalidate view , cause -drawrect: called, should drawing (ie call drawstuff)

conceptually, -drawrect: should dumb method knows how actual drawing work based on whatever current state of view is. normal event logic (or timer) outside of should (a) update state necessary , (b) mark view needing redrawn.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -