Hi,
How to access a variable from an Object in Objective-C. ie if i have a variable of say:
(NSString*) string;
How do i access this through an object?
Hi,
How to access a variable from an Object in Objective-C. ie if i have a variable of say:
(NSString*) string;
How do i access this through an object?
Directly by dot notation
obj.myString = str
str = obj.myString
Implement your own getter and setter
[obj setMyString: str]
[obj myString]
Have the compiler implement getter and setter by @property/@synchronized
[obj setMyString: str]
[obj myString]
All methods are covered in the Properties in Objective-C 2.0 Cocoa Cast.