0

If I have a image size 1024*768, but I want to show a 100*100 square located on 200, 200. What is the simplest way to do it? Thz u.

Tattat
  • 15,548
  • 33
  • 87
  • 138

1 Answers1

3

You're basically talking about a "Crop" operation.

From HitScan in this question:

CGImageRef imageRef = CGImageCreateWithImageInRect([largeImage CGImage], cropRect);
// or use the UIImage wherever you like
[UIImageView setImage:[UIImage imageWithCGImage:imageRef]]; 
CGImageRelease(imageRef);
Community
  • 1
  • 1
jessecurry
  • 22,068
  • 8
  • 52
  • 44