我像这样切换第一个 tabbaricon 的标签名称:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
NSString *temp = [[NSUserDefaults standardUserDefaults] stringForKey:@"stateOfSwitch"];
if ([temp isEqualToString:@"OFF"]) {
self.title = NSLocalizedString(@"TabButtonOFF", nil);
}
else {
self.title = NSLocalizedString(@"TabButton1", nil);
}
self.tabBarItem.image = [UIImage imageNamed:@"first"];
}
return self;
}
通过启动和停止应用程序可以正常工作,但是有没有办法刷新(重新加载)标签名称?运行时?