My problem is this: I have a simple block image from which I want to make a grid. I created an array of CGPoints in my UIView. Then i used
blackImage = [UIImage imageNamed:@"black.png"];
and then
- (void)drawRect:(CGRect)rect {
for (int j = 0 ; j <= 11; j++)
{
for (int i = 0 ; i <= 7; i++)
{
[blackImage drawAtPoint: (CGPointFromString([[self.points objectAtIndex:j] objectAtIndex:i]))];
}
}
[whiteImage drawAtPoint:(CGPointMake((CGFloat)(floor((touchX+0.001)/40)*40), (CGFloat)(floor((touchY+0.001)/40))*40))];
}
Where TouchX and TouchY are CGPoints where the user touched the screen. Therefore, I basically show another image at the grid point where the user touched.
First of all, the problem is that the whole screen is redrawn every time I call DrawRect. I want to save state (by changing the BOOL array?) And ask the user to drag and drop multiple images onto the screen. However, I cannot use the drawAtPoint method in UImage when I am outside of DrawRect. (gives an error message).
, CoreAnimation Quartz . , UIView ( ) CALayers CGLayers... , , ... , CALayer CGLayer. -, " UIViews " ?
, . , "" .
[self setNeedsDisplayinRect] CGRect . , - DrawRect TouchesMoved, , , iPhone. CALayers? Core Animation , .