我遇到与UINavigationItem title label set width?类似的问题我将后退按钮添加为子视图
[self.navigationController.navigationBar addSubview:backButton];
和我的方法只适用于[iOS ver]< 6
-(void)setNavTitle:(NSString *)title{
UILabel *label;
CGRect frame = CGRectMake(0, 0, 220, 44);
label= [[[UILabel alloc] initWithFrame:frame] autorelease];
label.backgroundColor = [UIColor clearColor];
label.textAlignment = NSTextAlignmentCenter;
[label setBaselineAdjustment:UIBaselineAdjustmentAlignCenters];
[label setMinimumFontSize:6.0];
[label setAdjustsFontSizeToFitWidth:TRUE];
label.textColor = [UIColor whiteColor];
label.text = title;
self.navigationItem.titleView=label;
}
如何强制此代码与iOS6一起使用?谢谢你的帮助!