Graphics Reference
In-Depth Information
//only draw brush stroke if it intersects dirty rect
if
(
CGRectIntersectsRect
(rect, brushRect))
{
//draw brush stroke
[[
UIImage
imageNamed
:
@"Chalk.png"
]
drawInRect
:brushRect];
}
}
}
Figure 13.4
Better frame rate and smoother line thanks to smarter drawing
The single-threaded nature of UIKit means that backing images usually have to be updated
on the main thread, which means that the drawing interrupts user interaction and can make