Objective c 在viewcontroller之间传递字符串
我想使用属性(方法)将字符串从一个viewcontroller传递到另一个viewcontroller。有人能用objective c详细解释我吗?我们应该在属性(方法)中使用情节提要吗?如果您正在使用情节提要分段并希望在另一个ViewController上将stringA传递给stringB:Objective c 在viewcontroller之间传递字符串,objective-c,Objective C,我想使用属性(方法)将字符串从一个viewcontroller传递到另一个viewcontroller。有人能用objective c详细解释我吗?我们应该在属性(方法)中使用情节提要吗?如果您正在使用情节提要分段并希望在另一个ViewController上将stringA传递给stringB: - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([[segue identifier] is
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString:@"YourVCIdentifier"])
{
YourViewController *yourVC = [segue destinationViewController];
yourVC.stringB = stringA;
}
如果没有:
YourViewController *yourVC = [[YourViewController alloc] init];
yourVC.stringB = stringA;
[self presentViewController: yourVC animated:true completion:nil];
欢迎来到StackOverflow。请阅读以下关于如何提出适当问题的内容:请查看此链接,该链接解释了如何提出适当问题,不幸的是,您太宽泛了:。另外,我试着用你使用的标题在谷歌上搜索:第一页只包含来自StackOverflow的类似问题。也许你已经可以找到你需要的,如果你仍然有问题,我们会很乐意帮助你。