我使用了self.navigationItem.titleView
,并在self.navigationItem.rightBarButtonItems
中设置了两个UIButtons作为UINavigationBar
。我已经在我的navigationBar中实现了这一点,就像
每当我旋转视图控制器景观然后再返回时,uibarbutton项就会被切断
我用来设置titleView
的代码是:
UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 0, 44)];
titleLabel.backgroundColor = [UIColor clearColor];
titleLabel.numberOfLines = 2;
titleLabel.font = [UIFont boldSystemFontOfSize:13.0f];
titleLabel.shadowColor = [UIColor colorWithWhite:0.0 alpha:0.5];
titleLabel.textAlignment = UITextAlignmentCenter;
titleLabel.textColor = [UIColor whiteColor];
titleLabel.text = self.tabTitle;
self.navigationItem.titleView = titleLabel;
我不知道为什么会这样,我想知道你是否有人知道如何解决这个问题。