how to push data from one viewController to another without using Segues

时间:2016-05-17 11:15:10

标签: xcode viewcontroller

i have two view controllers TestViewController and SecondViewController. i also have corresponding views TestView and SecondView corresponding to them.

please guide me with the steps to push data from one view Controller to another without using Segues.

1 个答案:

答案 0 :(得分:0)

你可以使用 Segues它很容易使用。您可以在objective-c代码中使用方法: 例如:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Make sure your segue name in storyboard is the same as this line
    if ([[segue identifier] isEqualToString:@"YOUR_SEGUE_NAME_HERE"])
    {
        // Get reference to the destination view controller
        YourViewController *vc = [segue destinationViewController];

       // Pass any objects to the view controller here, like...
        [vc setMyObjectHere:object];
    }
}

在上面的链接中,您可以获得所有解释... :)希望它有所帮助。