Thanks for the clarification. It’s not that I mind using C++ mixed with Obj-C, I was just wondering about how exactly one would initialize and use Obj-C objects in C++. Is it done just like in C++, or is there a differing syntax? That’s what I was wondering.
It’s exactly the opposite, it’s done just like in obj-c. So you use the obj-c syntax, which needs some getting used to when you’ve got a c++ background. Apple documentation is OK, I’d say start with this-one and you’ll get there.
What confuses me, though, is that there is still dot notation for some functions and accessors, and I’m having trouble distinguishing.
That is called ‘properties’. In the header file (‘interface’) you can use the ‘@property int myNumber’ statement, and if you say ‘@synthesize myNumber’ in your implementation, objective-c just did you a favor and created a getter and a setter for you. These are accesible by using the bracket syntax:
int myOtherNumber = [myClass myNumber];
By tweaking the ‘@property …’ statement you change the getters and setters that are created, so you can set wether to assign, retain or copy, whether the variable is atomic or not, and if you are allow to readonly or readwrite:
@property(nonatomic, retain) int myNumber;
@property(readonly, copy) int otherNumber;
As I said, these are accesible using the bracket syntax. If you use the dot syntax, you don’t use the getters and setters obj-c created for you. You are directly editing the member variables of the class, which isn’t necessarily a bad thing, but most of the time Apple says it is:
int myOtherNumber myClass.myNumber;
myClass.myNumber = yetAnotherNumber;
Remember, all the fancy memory management stuff objective-c put in the getters and setters are being skipped right now, so you’ll have to take care of that yourself.
I hope this clarifies the dot-syntax a bit.
Oh and I almost forgot:
In your header:
In your implementation:
myTextView = [[UITextView alloc] initWithFrame:CGRectMake(someX, someY, someWidth, someHeight)];
I never did this directly in a GL view so I can’t really predict how this will work out for you, but give it a try and let us know