我想在解雇模式后更新UILabel时遇到问题。 基本上我有: 一个带有一些UILabel和UIButtons的ViewController 当我触摸一个按钮时,它会打开一个带有文本字段的模态,我在这个文本字段中输入一些文本,然后保存到我所做的CacheHandler实例中。 然后我用一个按钮解雇我的模态,我想看看我在UILabel中输入的文字。 文本保存在缓存中,我已经检查过了。当我从自定义segue调用它时,我有一个更新标签的方法,标签值为null。我在哪里做错了?
自定义segue:
#import "DismissModalSegue.h"
#import "CreateSqeedViewController.h"
@implementation DismissModalSegue
- (void)perform {
UIViewController *sourceViewController = self.sourceViewController;
CreateSqeedViewController *destViewController = self.destinationViewController;
[sourceViewController.presentingViewController dismissViewControllerAnimated:YES completion:^{
[destViewController updateLabels];
}];
}
@end
updateLabels方法:
- (void)updateLabels {
NSLog(@"Updating labels: %@", [[[CacheHandler instance] createSqeed] place]);
/* displays what I want to display in my label */
NSLog(@"%@", whatLabel.text);
/* displays null */
whereLabel.text = [[[CacheHandler instance] createSqeed] place];
whatLabel.text = [[[CacheHandler instance] createSqeed] sqeedDescription];
NSString *peopleLabel = [NSString stringWithFormat:@"%@ / %@", [[[CacheHandler instance] createSqeed] peopleMin], [[[CacheHandler instance] createSqeed] peopleMax]];
whoLabel.text = peopleLabel;
whereLabel.text = [[[[CacheHandler instance] createSqeed] dateStart] description];
}
答案 0 :(得分:0)
哪里有初始化标签?与IBOutlet有联系吗? 当他们没有初始化时可能会回电话