How to send an NSString to another view controller

后端 未结 4 1874
时光说笑
时光说笑 2020-12-22 11:20

I have an IBAction that when triggered calls another method in a different view controller ( APICallsViewController). I\'m looking to also send that method an NSString (m

4条回答
  •  隐瞒了意图╮
    2020-12-22 12:12

    Declare a property in SecondViewController. Then you can get string in SecondViewController in 2ways.

    1. In FirstViewController someMethod after creating object for secondviewController you can assign the value directly

      second.string2 = [NSString stringWithFormat:@"%@", [textField text]];

    2. Create a method in SecondViewController and assign through it.

提交回复
热议问题