How to add a multiline title bar in UINavigationController
        Posted  
        
            by 
                Cocoa Matters
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Cocoa Matters
        
        
        
        Published on 2012-10-20T04:58:26Z
        Indexed on 
            2012/10/20
            5:00 UTC
        
        
        Read the original article
        Hit count: 159
        
I have try to add a two line title bar in UINavigationController
I want to adjust font size automatically set according to string length.My String max size goes to 60. I have try to implemented through following code
UILabel *bigLabel = [[UILabel alloc] init];
bigLabel.text = @"1234567890 1234567890 1234567890 1234567890 1234567890 123456";
bigLabel.backgroundColor = [UIColor clearColor];
bigLabel.textColor = [UIColor whiteColor];
bigLabel.font = [UIFont boldSystemFontOfSize:20];
bigLabel.adjustsFontSizeToFitWidth = YES;
bigLabel.clipsToBounds = NO;
bigLabel.numberOfLines = 2;
bigLabel.textAlignment = ([self.title length] < 10 ? NSTextAlignmentCenter : NSTextAlignmentLeft);
[bigLabel sizeToFit];
self.navigationItem.titleView = bigLabel;
It didn't work for me can you help me please. I have to made this for iPhone and iPad screen
© Stack Overflow or respective owner