I am using
UIImage *image = @"some image"
[image drawInRect:CGRectMake(50,50, 100, 100)];
How can i check draw image only
if(cgrect(50, 50, 100, 100) doesn't have an image){
// only then draw the image
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Quartz (the 2D graphics system on iOS) uses the painter’s model of graphics composition, and in most cases draws to a single-layer buffer.
What that means is that once content is drawn to a graphics context, it is flattened into the context and its pixels become part of the scene. Think of it like painting a picture: once you put down paint on your canvas, it covers up anything underneath and becomes inseparable from paint already present there.
In order to determine if an image was previously drawn in a graphics context, you will have to maintain some state external to the context (e.g. a
BOOL didDrawImage.) Exactly what you need to do depends on your goal. If you tell us what you’re trying to achieve, we may be able to provide alternate solutions to the problem.