Reputation: 13
My Question is about the setNeedsDisplay method which is in my UIView sub class which doesn't call the drawRect in the same class.
I'm developing an Ipad application to show a X Y Graph (cartesian plane) where a user can enter coordinates for points. (ex: 2,4 and 2,8: this should draw a straight vertical line). I used a Master-Detail Application (so a split view controller).
1) Initially the drawRect in the UIView subclass draw the initial grid. I need to add the lines on the fly to the grid, when user adding the new points (x, y values)
2) And then after entering the x and y values (in the MasterViewController), I'm calling the point update method in UIView subclass (gridview) like the following:
- (void) updateGrid
{
// this is a mutable array of newly created points
self.gridview.pointList = self.pointList;
[self.gridview redrawGrid];
}
3) I have the setNeedsDisplay in the method, "redrawGrid" in the UIView subclass (gridview) to call the drawRect in order to redraw the grid with new data points.
Upvotes: 1
Views: 288
Reputation: 130102
My guess is that you have a problem inside the drawRect:
. Put a breakpoint inside the drawRect:
method and you should see very fast what's going on.
Also make sure that setNeedsDisplay
is really called.
Upvotes: 1