Change iPhone navigation bar's height

前端 未结 6 368
栀梦
栀梦 2020-12-01 09:56

My client can\'t read iPhone\'s default fonts, the size is too small. I have an application with a navigation bar and I need to make everything in it bigger, for example, th

6条回答
  •  无人及你
    2020-12-01 10:43

    If you decided to just change the font size in the navigation bar, you can do this (usually in your UIViewController's viewDidLoad method):

    UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectZero];
    
    [titleLabel setBackgroundColor:[UIColor clearColor]];
    // here's where you can customize the font size
    [titleLabel setFont:[UIFont boldSystemFontOfSize:18.0]];
    [titleLabel setTextColor:[UIColor whiteColor]];
    [titleLabel setText:self.title];
    [titleLabel sizeToFit];
    [titleLabel setCenter:[self.navigationItem.titleView center]];
    
    [self.navigationItem setTitleView:titleLabel];
    
    [titleLabel release];
    

提交回复
热议问题