- (void)setTitle:(NSString *) title
{
[super setTitle:title];
UILabel *titleView = (UILabel *)self.navigationItem.titleView;
if(!titleView){
titleView = [[UILabel alloc] initWithFrame:CGRectZero];
titleView.backgroundColor = [UIColor clearColor];
titleView.font = [UIFont boldSystemFontOfSize:20.0];
titleView.shadowColor = [UIColor colorWithWhite:0.0 alpha:0.5];
titleView.textColor = [UIColor blackColor];
self.navigationItem.titleView = titleView;
}
titleView.text = title;
[titleView sizeToFit];
}
这个群里找的,是图片,我一个个的码上去的。。。
本文详细介绍了如何在iOS应用中自定义导航栏标题的实现过程,包括标题的设置、样式调整以及尺寸适配。
14

被折叠的 条评论
为什么被折叠?



