I have deep searched for your question.Well asked Leem.fin brother.I tried sample one
#import "SecondViewController.h"
@interface SecondViewController ()
{
NSString *variableOne;
}
@end
@implementation SecondViewController
{
NSString *variableTwo;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
[self setValueToString];
NSLog(@"The variable One is - %@",variableOne);
NSLog(@"The variable Two is - %@",variableTwo);
}
-(void)setValueToString
{
variableOne = @"iOS";
variableTwo = @"iPhone";
}
The printed results are
The variable One is - iOS
The variable Two is - iPhone
But when I tried to access these in Class method
+(void)changeStrings
{
variableOne = @"iPad"; //I get error here
variableTwo = @"iMac"; //I get error here
}
The error shows
Instance variable 'variableOne' accessed in class method
Instance variable 'variableTwo' accessed in class method
From above code I understood
Both are instance variables
That can be accessed only in instance methods
There is no difference between them
So Where to put
Difference between them
Difference between putting variable inside interface and implementation