Reputation: 7286
In the iPhone music app the right UIBarButtonItem
title is "Now Playing" (on two lines). I want to do something similar. How can I make the title two lines?
UIBarButtonItem *nowPlayingButtonItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Now Playing", @"button in navigationbar right") style:UIBarButtonItemStyleBordered target:self action:@selector(showNowPalyView)];
Upvotes: 0
Views: 1782
Reputation: 12671
It depends on what you are using as the title, in general the new line character does the job.
NSString *titleStr=@"Now\nPlaying";
If you are using UIButton
or UIlabel
then you have to set the lines accordingly
In case you are using custom button out there
[titleButton.titleLabel setLineBreakMode:UILineBreakModeWordWrap]; // will set the line break mode
[titleButton setTitle:titleStr forState:UIControlStateNormal];
Upvotes: 2
Reputation: 47099
Best way is Add UILabel
to UIBarButtonItem
and use label.numberOfLines = 0
;
Upvotes: 0