xcode更改标签的文字后presentViewController

问题描述:

一如既往依靠这个社区至多真的很有帮助!xcode更改标签的文字后presentViewController

我真的不明白为什么我的代码不工作,我在ViewControllerA中玩游戏,例如有“运动”和更多的东西显示,这些是显示int变量的标签,这些给我没有问题,因为他们正确地改变,当游戏完成时,我想显示分数和更多...

所以我创建了另一个ViewController来做到这一点,ViewControllerB的例子,事情是,A和B Viewcontrollers属于到SAME类,所以我应该能够使用相同的变量,方法和一切(实际上我已经这样做,它工作正常)

我创建了IBOutlet的一些标签,这个belon克至B.我使用presentViewcontroller方法来显示它的标签,没有得到任何改变,这里是代码:

NSString *moviments = [NSString stringWithFormat:@"%d",TotalMovements]; 
NSString *score = [NSString stringWithFormat:@"%d",TotalPoints]; 
NSString *levelToShow = [NSString stringWithFormat:@"%d",PlayingLevel]; 


[movementsToShowOnCompletedScreen setText:moviments]; 
[scoreToShowOnCompletedScreen setText:score]; 
[levelToShowOnCompletedScreen setText:levelToShow]; 

UIStoryboard *winOFLevelStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; 
UIViewController *vc = [winOFLevelStoryboard instantiateViewControllerWithIdentifier:@"mainGame"]; 
[self presentViewController:vc animated:YES completion:^{ 


    /*I have tried to add the same code from above setting the labels text 
    labels here, same result... 

    */ 
}]; 

标签没有得到它的文本改变。

这就是它,我希望所有这些你可以找到这里发生了什么,IBOutlets很好,我甚至在程序中改变了这些标签的框架,所以不能成为问题,网点都很好。

如果你需要更多的代码或任何东西只是让我知道!

谢谢你的时间!

嗯,我发现它......以防万一任何人都有同样的问题。它解决了它,但不是我想要的方式,如果有人知道这个好方法,请让我知道。

由于这些属于同一类,我刚才复制/粘贴下面这行显示到我的viewdidload方法,现在标签正在改变,当他们必须但我真的认为这是一个非常糟糕的解决方案。

再次感谢!