Reputation: 5240
I want to draw as well as redraw some lines from view into my sub-view say I have big view and I want to draw a line inside my mySubView. I know by the help of drawrect event I can draw some line but this event calls only once at the starting of the program actually I want to put some button and then draw my lines and stuffs like that whenever I want.
Upvotes: 0
Views: 147
Reputation: 446
In your buttonPush action handler, call the setNeedsDisplay
, it will mark the view's entire bounds rectangle as needing to be redrawn ( thus , your drawRect:
will be executed )
-(IBAction)buttonPush:(UIButton *)sender
{
...
[mySubView setNeedsDisplay];
}
Upvotes: 4