Im trying to get my head around Objective C and struggling fast. Im guessing what I am asking here is fairly rudimentary, but I cant seem to find the answers to my problems anywhere on StackOverflow, the Mac Developer Library or the internet in general.
Im trying to use the code from here: http://snipplr.com/view/23024/ to import an Image and display it.
UIGraphicsBeginImageContext
and
[img drawInRect:...]
are kicking up errors, namely "Unknown name type UIImage" and "No visible @interface for 'UIImage' declares the selector 'drawInRect'"
Looking here I can find that drawInRect is a method of UIImage. Im guessing my problem is that the UIImage class cannot be found in my code.
So Im trying to include it, or import it - and Im just drawing a blank here - these lines of code dont work:
#import "UIImage"
#import "UIImage.h"
#include "UIImage"
#include "UIImage.h"
They kick out "file not found" errors. I have no idea how to locate these files, Im sure I am missing something really fundamental and simple, but cant find anything online that sheds any light on how to stop UIImage from being an "Unknown name type".
Can anyone help?
If your on a mac your going to want NSImage instead.
If you are on iphone make sure your prefix.pch includes #import <UIKit/UIKit.h>
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