@property Objective-C -


I'm following some tutorials, and with the example frequency of my class, I doubt about @property, Which is another class. @ Interface rectangle: NSObject {int width; Inti height; XYpoint * Basic; } @ Property int width, height;

I have my XYpoint class in the second file, and everything works well, but in the tutorial I am in the following program, it creates a "rectangular * R", and the dot Uses Syntax with the original variables like this:

r.origin = ****;

I am searching for how to add object variables to a property @ but I have not got anything, and I was trying to add it in many ways, but no success I could try to add someone else:

  "@property XYpoint * Basic" and " @ Synthesis * original "  

also without asterisk, and many other methods ...

your address Is already a frequency variable XYpoint * origin , so what you want is to create an asset that is supported by that frequency variable and it synthesizes I usually have an underscore prefix on Iver So that you do not end up with misleading alerts or accidentally see the wrong one, but it's up to you something like this:

  @ interface rectangle: NSOGIES {XYpoint * _origin ; } @ Property (non-dynamic, strong) XYpoint * Basic; @end @implementation @ synthesize origin = _origin; // The rest of your class, @end   

Now while using that class, you should be able to refer to the property using dot syntax:

 < Code> rectangle * rect = [[rectangle] [init]]; XYpoint * pointFromRect = rect.origin;    

Comments