I am seeing that "Back" button title is missing when my screen title is big. I needed to show the entire title. Is there any workaround to this?
Please see attached the screenshot of navigation bar I see with long title.
I am seeing that "Back" button title is missing when my screen title is big. I needed to show the entire title. Is there any workaround to this?
Please see attached the screenshot of navigation bar I see with long title.
Make your screen title smaller. You can take control of it by using a titleView
that's a UILabel. The advantage is that you can set its size, and that it can truncate its text and/or make the text occupy two lines if the text is too big (rather than just growing, as the title
does).
UIView *iv = [[UIView alloc] initWithFrame:CGRectMake(0,0,170,35)];
[iv setBackgroundColor:[UIColor whiteColor]];
_titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 170, 35)];
_titleLabel.textAlignment = UITextAlignmentCenter;
[_titleLabel setFont:[UIFont boldSystemFontOfSize:16.0]];
[_titleLabel setBackgroundColor:[UIColor clearColor]];
[_titleLabel setTextColor:[UIColor blackColor]];
[_titleLabel setText:@""];
_titleLabel.clipsToBounds = false;
iv.clipsToBounds = false;
[iv addSubview:_titleLabel];
[self.navigationItem setTitleView:iv];
also you need @property (strong, nonatomic) UILabel* titleLabel;