我有一个标签,该标签使用addSubView属性显示在UINavigationBar上,并且显示如下:
但是,当我要使用secondView Controller时,它看起来像:
它出现在第二个控制器的“后退”按钮上。因此,如何从第二个UI中删除“状态”标签。
谢谢。
最佳答案
在第一个View控制器中-
-(void)viewWillAppear:(BOOL)animated
{
//Add Label on UINavigationBar
[super viewWillAppear:animated];
[self.navigationController.navigationBar addSubview:navLabel];
}
-(void)viewWillDisappear:(BOOL)animated
{
// Remove label from UINavigationBar
[super viewWillDisappear:animated];
[navLabel removeFromSuperview];
}