If we have to transfer data from one view controller to another then we generally use prepare for segue method but in case of Tabbar do not need to use that method, we can directly send data in following way:
For Example: suppose we have to send one data lets take name from FirstViewController to SecondViewController and in between of these two there is a Tabbar, then we can use below code.
In first view controller->
NSString * name=@Jaya;
NSString * str= [(TabBarControllerClassName *)self.tabBarController name]; //we have to import TabBarControllers class here
In second View Controller we can do this->
NSString * fetchUserName=[(TabBarControllerClassName *)self.tabBarController name]; //got data in fetchUserName string
Now we got the name data in second view controller and according to our need we can use this.
0 Comment(s)