As a practical example, in UIView, drawRect is called when setNeedsDisplay is set. I want a different drawRect routine to be called for the first time vs. the subsequent update. So for example, I want drawRect to call drawRectFirstTime for the first time and drawRect to call drawRectSubsequentUpdate for subsequent setNeedsDisplay.
How should this be done in Objective-C?
From top of my head:
- (void)drawRect:(NSRect)rect
{
static BOOL first = YES;
if (first == NO)
{
[self drawRectSubsequentUpdate:rect];
} else {
[self drawRectFirstTime:rect];
first = NO
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.