I am trying to put a label in a UIBarButtonItem. Here is my viewDidLoad method:
characterCountLabel = [[UILabel alloc] init];
characterCountLabel.text = @"HELLO";
charCountButton = [[UIBarButtonItem alloc]initWithCustomView:characterCountLabel];
Everything is hooked up properly in IB. Why is the label not appearing inside of my UIBarButtonItem?
A couple things come to mind. First, your label has no frame. Try using
Next, can you show us the code where you actually add the bar button item? What are you adding it to–a navigation bar or a toolbar?
When you say everything is hooked up in IB, what are you referring to? The toolbar? Navigation bar? Are you using a navigation controller? If not, then you should be able to just add an item to a navigation bar in IB.
A little more information would help us help you.