Reputation: 9320
I tried to use setNeedsDisplay, but that is very much up to the mercy of the system whether to refresh right the way. Currently I remove and add the subview every time, so the latest content is forced to show. The code works, however it lacks gracefulness.
[myView removeFromSuperview];
[myView release];
myView = [[MyView alloc] initWithFrame:CGRectMake(0.0, MY_VIEW_Y, 320.0, MY_VIEW_H)];
[self.view addSubview:myView];
//[self.myView setNeedsDisplay];
[self.view bringSubviewToFront: myView];
Upvotes: 0
Views: 2514
Reputation: 1751
Your view should be getting redrawn at the next drawing cycle. Is this not happening or is this too slow for you? ... i.e.: how fast do you need it to redraw and what latency are you seeing between calling setNeedsDisplay and drawRect being called?
If you need more precise control of the drawing, you may need to use a view backed by CAEAGLLayer, in which case it runs from openGL and setNeedsDisplay has no effect.
Upvotes: 2