Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How To transfer data from one viewcontroller to another viewcontroller in Tabbar?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 428
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: