I had tried accessing value of IVAR of one viewcontroller to another viewcontroller by making use of property , but i am getting null value.
please let me know how to get value displayd in my secondviewcontroller.
I had tried accessing value of IVAR of one viewcontroller to another viewcontroller by making use of property , but i am getting null value.
please let me know how to get value displayd in my secondviewcontroller.
You are doing the right way to get value of property. But you need to make sure myString
has been assigned a value in init
method of ViewController
.
Try in ViewController.m:
- (instancetype)init {
self = [super init];
if (self) {
self.myString = @"My String";
}
return self;
}
Beside of it, make sure that myMetod
of SecondViewController is called. If myMetod
is called, "Print value My String" will be printed.