#import <Foundation/Foundation.h>
@interface Person : NSObject
@property(strong,nonatomic) NSString *firstName;
@end
Asked
Active
Viewed 152 times
-4

Nirav D
- 71,513
- 12
- 161
- 183
-
can you elaborate it? – Sivajee Battina Dec 26 '16 at 06:51
1 Answers
0
If you want to access "firstName" in Person.m then simply you can use
self.firstName
And If you want to access it in any other controller then you will have to create object of Person Class and then only you can read or write it's properties. e.g.
Person *person = [[Person alloc] init];
person.firstName = @"Xyz";
NSLog(@"name is->%@", person.firstName);

Krishna Datt Shukla
- 987
- 8
- 21
-
-
self.variable will retain an object for you if you mark the property with retain or strong. _ variable does not address memory management at all.. This is well descibed here.. http://stackoverflow.com/a/10333755/5172413 – Krishna Datt Shukla Dec 26 '16 at 07:12