【发布时间】:2021-06-25 02:30:34
【问题描述】:
所以我有一个 UITabBarController,它下面有 4 个视图。
其中一个具有 IBOutlet LABEL 用于消息的 ViewController(称为 optionsViewController)。我将其用作屏幕上的一种调试消息,我可以更新。
TabBarController 调用名为 UpdateDeviceStatus 的 optionsViewController 函数
应用启动时,在 viewDidLoad 函数中,STATUS 标签设置为“BLAH”。
但是当 TabBarController 调用 UpdateDeviceStatus 时,标签并没有更新。
@synthesize device_firmware_version, device_status;
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.device_status.text = @"BLAH";
}
- (void) UpdateDeviceStatus:(NSString *)status
{
NSLog(@"Updating Status: %@", status);
self.device_status.text = status;
}
Storyboard中的Label是连接的,头文件中的连接是(nonatomic, retain)
@property (nonatomic, retain) IBOutlet UILabel *device_status;
如果我们查看 LOG 文件,变量 status 是正确的。但是屏幕上的 LABEL 没有更新。我设置了断点,它只会进入一次viewDidLoad,它会进入一次UpdateDeviceStatus。
我遗漏了一些明显的东西,stackoverflow....请帮助。
【问题讨论】:
标签: ios objective-c uiviewcontroller uitabbarcontroller