NavigationItem.titleView custom自定义

NSMutableAttributedString *titleString = [[NSMutableAttributedString alloc]initWithString:@"Cloud 2 Door"];spa

    [titleString addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithRed:185/255.0 green:225/255.0 blue:238/255.0 alpha:1.0] range:NSMakeRange(0, 5)];it

    [titleString addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(6, 6)];io


UILabel *customLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 30)];table

    [customLab setTextColor:[UIColor blueColor]];tab

    [customLab setAttributedText:titleString];vi

    customLab.font = [UIFont boldSystemFontOfSize:24];co

    customLab.textAlignment = NSTextAlignmentCenter;ab

    self.navigationController.navigationItem.titleView = customLab;

相关文章
相关标签/搜索