开发者

navigationItem change font color / alpha?

开发者 https://www.devze.com 2023-02-08 01:57 出处:网络
Is there a way to alter either the color or the alpha of the text that is displayed on the navigationItem? Currently its bright white and I would (if possible) like to knock it back a little so its no

Is there a way to alter either the color or the alpha of the text that is displayed on the navigationItem? Currently its bright white and I would (if possible) like to knock it back a little so its not so bright. Any 开发者_C百科info would be much appreciated.

- (void)loadView {
    [[self navigationItem]setTitle:@"Location List"];
    ...
    ...

navigationItem change font color / alpha?


You need to use setTitleView instead and give it a label - Something like this:

UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, 30)];
titleLabel.textColor = [UIColor redColor];
titleLabel.backgroundColor = [UIColor clearColor];
titleLabel.text = @"My Title";
[self.navigationItem setTitleView:titleLabel];


you can place new label there:
http://www.iphonedevsdk.com/forum/iphone-sdk-development/1039-change-font-size-navigation-bar.html


 UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, 30)];
    titleLabel.textColor = [UIColor colorWithRed:0.0/255.0 green:77.0/255.0 blue:134.0/255.0 alpha:1.0];
    titleLabel.backgroundColor = [UIColor clearColor];
    titleLabel.text = @"Videos";
    titleLabel.textAlignment = NSTextAlignmentCenter;
    titleLabel.font = [UIFont boldSystemFontOfSize:18];
    [self.navigationItem setTitleView:titleLabel];
    //VKJ
0

精彩评论

暂无评论...
验证码 换一张
取 消