0
之前并不清楚以前的游戏
所以我创建了一个自定义的UINavigationItem类能够使自定义titleview的我的导航栏,但每次我推/弹出一个视图,它只是增加了新的标题没有摆脱旧的导致标题只是一堆字母。这里的相关代码:自定义导航栏titleview的将加载新的
@implementation UINavigationItem (CustomNavigationItem)
-(UIView *)titleView
{
[self setTitleView:nil];
UILabel *newTitleView = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 220, 32)];
newTitleView.center = CGPointMake(160, 22);
newTitleView.backgroundColor = [UIColor clearColor];
newTitleView.textColor = [UIColor whiteColor];
newTitleView.textAlignment = UITextAlignmentCenter;
newTitleView.text = self.title;
newTitleView.textAlignment = UITextAlignmentCenter;
return newTitleView;
}
@end
任何返回后调用(因此也就是为什么它被称为“回归”),但你最大的问题是,如果该代码被执行,它将无限递归。 – CodaFi 2012-03-09 03:43:08
对不起,返回后的声明是一个错字。是递归吗?还是我错过了一些明显的东西? – JoeCortopassi 2012-03-09 05:55:51