Reputation: 5160
I can see just this (text should be "item" and it is showing "I...m")
When I try to add a navigation bar item using the storyboard. Anybody know why? This is how I'm adding that button:
self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "Item", style: .Plain, target: self, action: nil)
Upvotes: 0
Views: 202
Reputation: 3519
Put a UIButton as the customView of the UIBarButton to set a custom width of the UIBarButton.
// create the nav bar back button
UIButton *backButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 50, 24)];
[backButton setTitle:@"Item" forState:UIControlStateNormal];
[backButton addTarget:self action:@selector(backButtonAction) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *buttonItem = [[UIBarButtonItem alloc] initWithCustomView:backButton];
self.navigationItem.leftBarButtonItem = buttonItem;
Upvotes: 1