I have a question, here\'s the code:
@interface MyFoo : NSObject {
NSString *nameStr;
}
@end
@implementation MyFoo
- (id)init {
self = [super init];
Using arrow notation on just the ivar name to access a property will not guarantee they will be retain, assign or etc ... Because you are directing accessing an ivar and not calling and setter ou getter method used in properties.
Example:
@interface MyFoo : NSObject {
}
@property(nonatomic,retain) NSString *nameStr;
@end
@implementation MyFoo
- (id)initWithString:(NSString *)name {
self = [super init];
if (self) {
self->nameStr = name; // will not be retained
}
return self;
}
@end
For ivar variables as already be answer there`s nothing wrong.