【发布时间】:2014-11-12 17:57:25
【问题描述】:
我在将自定义标签附加到我的 UIBarButtonItem 时遇到问题。我的代码:
UILabel *lbl=[[UILabel alloc]initWithFrame:CGRectMake(0.00, 0.00, 10.0, 10.0)];
lbl.font=[UIFont fontWithName:@"Verdana" size:7];
lbl.textAlignment=NSTextAlignmentCenter;
lbl.textColor=[UIColor darkGrayColor];
lbl.text=@"Subtypes available:";
lbl.backgroundColor=[UIColor lightGrayColor];
_btnSubtypes.enabled=YES; // UIBarButtonItem
_btnSubtypes.title=[NSString stringWithFormat:@"%lu / %lu",[_ucqc returnQuantityOfListedSubtypes:_coin],[_ucqc returnPureQuantityOfSubtypesInType:_coin]];
[_btnSubtypes setAction:@selector(navigateToSubtypes)];
[_btnSubtypes.customView addSubview:lbl];
此代码在viewWillAppear 方法中执行。所以,它没有设置标签。它有什么问题?
提前谢谢你。
【问题讨论】:
标签: ios cocoa-touch uibarbuttonitem