Simple Passing of variables between classes in Xcode

前端 未结 3 1524
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-18 11:27

I am trying to do an ios app but I am stuck at passing data between classes . This is my second app . The first one was done whit a global class , but now I need multiple cl

3条回答
  •  攒了一身酷
    2020-12-18 12:03

    if you use segue between 2 controllers you must overload prepareToSegue method

    -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
    {
    // check if it's the good segue with the identifier
    if([[segue identifier] isEqualToString:@"blablabla"])
    {
        // permit you to get the destination segue
        [segue destinationViewController];
        // then you can set what you want in your destination controller
    }
    }
    

提交回复
热议问题