Or I should ask why is it so difficult for me? The answer is probably that I'm new to iPhone development and I'm trying to ditch my old methods and step into the new platform of the future. From start to finish, I have a few questions about this process...
CGImageCreateWithPNGDataProvider
helper method, but says it's not supported by the iOS SDK. I'd like to use the CGImageRef for repeatedly drawing the image to a bitmap context.Thanks so much in advance and I apologize for the lengthy question, I'm just surprised it's such a convoluted process compared to some other platforms.
If you load into UIImage, you can get a CGImageReg:
UIImage *image = [UIImage imageNamed:@"image.png"];
CGImageRef imageRef = [image CGImage];
1) It can go anywhere in Groups & Files, but if you only have a few, I'd recommend sticking it into the Resources groups. Remember, the groups in Groups & Files don't match actual folders in your directory structure however. They simply exist to organize your files.
2) Just drag it into the Groups & Files pane.
3) I'd use the 'copy' option. Not copying it is often useful when you're linking to shared resources used by different projects.
4) I haven't used CGImageRef myself, but if you just want a UIImage, you can simply call its imageNamed: class method and specify the image name without any additional paths leading up to it. It's assumed the file will be relative to your application's main bundle.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With