I\'m currently using the iOS 5 SDK trying to develop my app. I\'m trying to make an NSString a property, and then to synthesize it in the .m file (I have done this before wi
The name of the member starting with new is what triggers the warning. Change the name to editedTitle and the warning will go away. I was unable to find documentation confirming this but through testing was able to determine that member variables that begin with 'new' aggravate the compiler.
Besides the issue that you should/can't use "new" in front of you property names, let say one more thing: Try to avoid "new" in front of names in general. "New" is dependent on time. Currently it is new for you, but some time later you maybe want to implement something new again. So using "new" in names is always bad. Try to think this way: In the programming world, "new" is always creating something: a new instance of something.
In your case when you want to assign a different title then the current name your property titleReplacement.
One more thing: Try to name functions and methods with the verb first, like setSomething or getSomething. But in properties try to name the object first, like heightMinimum, heightMaximum, etc. -> when you use your inspector when you are coding, you always looking for objects. Try it out. ;-)
It doesn't look like what Bavarious was suggesting was what you wanted to do. All you want to do is declare an instance variable NewTitle
and then synthesize the property. We used to have to declare the instance variable and property. No more.
Now, I believe the right way of doing this is the following:
.h
@interface ViewController : UIViewController
@property (nonatomic, strong) NSString *newTitle;
.m
@synthesize newTitle = _newTitle; // Use instance variable _newTitle for storage
The instance variable for the property newTitle
is synthesized. You don't want your instance variable to be the same as your property - too easy to make mistakes.
See Example: Declaring Properties and Synthesizing Accessors
ARC does not allow to use "New...." in property name. but you can use "newTitle" by changing getter name.
@property (nonatomic, strong, getter=theNewTitle) NSString *newTitle;