49080

Back button title missing with long screen title in iOS 7

Question:

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.

<img alt="enter image description here" class="b-lazy" data-src="https://i.stack.imgur.com/0ykH7.png" data-original="https://i.stack.imgur.com/0ykH7.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" />

Answer1:

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).

Answer2:

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;

Recommend

  • Search bar with NSPredicate doesn't work
  • Objective C how to add textfield into navigation bar
  • How to change back bar button's width of a UINavigationController in iPhone?
  • How can I put a search bar in (not under) a unnavigationbar?
  • Google App Script Add-on approved for publishing?
  • basic.Nack not being processed
  • Swift Progress View with NSTimer
  • Is it possible to put layout xml's in subdirectories under /res/layout?
  • How to Update UILabel from Another ViewController
  • Grow Animation for Floating Action Button
  • this class is not key value coding-compliant for the key PerformRotate
  • Printing input from TextField to a Label in Xcode with Swift
  • Custom font for MKAnnotationView Callout
  • Get or convert Week of year to ISO week
  • Concise regex extract function in XSLT 2.0
  • How can I stop my python script when another python script is running?
  • Is it possible to “shrink” a PdfPtable?
  • Get UILabel out of UIButton
  • Best practice for switching iPhone views?
  • Does the MySQL IN clause execute the subquery multiple times?
  • Efficient & Pythonic way of finding all possible sublists of a list in given range and the minim
  • Change multiple background-images with jQuery
  • Ajax Loaded meta Tags
  • R - Combining Columns to String Based on Logical Match
  • Adding a button at the bottom of a table view
  • Android screen density dpi vs ppi
  • Nant, Vault & Windows Integrated Authentication
  • Read text file and split every line in MSBuild
  • Bug in WPF DataGrid
  • DirectX11 ClearRenderTargetViewback with transparent buffer?
  • Change an a tag attribute in JavaScript based on screen width
  • When should I choose bucket sort over other sorting algorithms?
  • jQuery tmpl and DataLink beta
  • How can I estimate amount of memory left with calling System.gc()?
  • Return words with double consecutive letters
  • how to add data labels for bar graph in matlab
  • How to set the response of a form post action to a iframe source?
  • Change div Background jquery
  • Qt: Run a script BEFORE make
  • reshape alternating columns in less time and using less memory