Objective c 仅在使用NIB启动parentView之后更改UILabel文本值不会显示更改

Objective c 仅在使用NIB启动parentView之后更改UILabel文本值不会显示更改,objective-c,ios,cocoa-touch,Objective C,Ios,Cocoa Touch,我的代码是这样的: if (messageBox == nil) { messageBox = [[MessageBoxController alloc] initWithNibName:@"MessageBoxView" bundle:nil]; } [messageBox.MessageLabel setText: someString]; [self presentModalViewController:messageBox animated:YES]; 但是,在第一次运行上述逻

我的代码是这样的:

if (messageBox == nil) {
    messageBox = [[MessageBoxController alloc] initWithNibName:@"MessageBoxView" bundle:nil];
}
[messageBox.MessageLabel setText: someString];
[self presentModalViewController:messageBox animated:YES];
但是,在第一次运行上述逻辑时(messageBox实际上为nil并被启动),新标签文本(someString)将不会显示。 文本将正确显示我运行此方法的以下时间(是的,它显示了最新的“someString”。而不是上次调用该方法时的实例)

我在设置标签文本后立即尝试了[messageBox.view setNeedsDisplay],但也没有任何帮助。在messageBox viewDidLoad方法中,我还设置了[self.MessageLabel setText:self.MessageLabel.text],以防出现异步初始化或其他情况


为什么新标签文本在第一次调用此方法时不显示?

原因是
UILabel
加载
并在该设置文本之前加载

if (messageBox == nil) {
    messageBox = [[MessageBoxController alloc] initWithNibName:@"MessageBoxView" bundle:nil];
}
[self presentModalViewController:messageBox animated:YES];
//make changes to UI after providing viewcontroller
[messageBox.MessageLabel setText: someString];

必须是简单明了的东西。谢谢