A property isn't the same thing OS a instance variable, you should read a little bit of them, there ' s plenty of sources I n the Internet.
Summarizing, a property was the combination of the instance variable (by default, automaticated declaraded with a Underscor e), and it ' s get and set methods.
To access the property inside your class, you should call self.propertyName
for, in your case it would be self.myTextfield
. This would access the gererated get method of the property. You can always, for course if you are inside the class, skip the Get method and access the variable directly. In this case, it would is _myTextfield
.
If you is not confortable with the automaticated instance variable generated, you can always declare your and bind I T with the property with the @synthesize
command. Like this:
@synthesize myTextfieldProperty = myTextfieldVariable;
Here's more information about the synthesize
. As I said before, this command binds one iVar to a property. So if you execute the line above, inside your class, you can either reference to the IVar directly, calling myTextfieldVariable
, or b Y the property, self.myTextfieldProperty
(there is a few differences actually between them, but I ' m not entering in details).
If you don ' t write synthesize
the, what Xcode does for you, automatically, is this:
@synthesize myTextfield = _myTextfield;
So, in your case, as a does not synthesize your property, Xcode automatically created the IVar with the underscore in th E beginning. It ' s just a pattern that Xcode follows.
The line @synthesize myTextfield;
, without binding an iVar directly, was simple the same as
@synthesize myTextfield = myTextfield;
i.e. creating a iVar with the same name of the Your property. And why these lines is actyally the same thing? I don ' t know, again, it ' s just a pattern that Xcode follows.
Use of undeclared identifier * * *, did you mean * * *. In Xcode