当我使用委托将值传递给另一个ViewController
时,我发现委托什么都不做。 我只是可以删除该委托和我还是可以通过值!当我使用委托将值传递给另一个ViewController时,我发现委托什么都不做
当我需要将一个值从ViewControllerA
传递到ViewControllerB
,我只是做了这个工作!
- (IBAction)sendToB:(id)sender {
ViewControllerB *viewB=[[ViewControllerB alloc]initWithNibName:@"ViewControllerB" bundle:nil];
[viewB getValue:self.textInput.text];
[self presentViewController:viewB animated:YES completion:nil]; }
然后在ViewControllerB
,我确实得到了价值。 但这是无关的委托,我记得人们都说使用委托两个ViewControllers
之间传递价值。那么有什么区别?谢谢!
谢谢你! – user3527021
我想知道当我尝试从VCB移回VCA时,我不需要使用:ViewControllerA * viewA = [ViewControllerA alloc] init]; [self presentViewController:viewA animated:YES completion:nil]; ? – user3527021
非常感谢!我认为我在路上是正确的。 – user3527021