• 例如微博发送微博导航条内容


    - (void)viewDidLoad

    {

        [super viewDidLoad];

        

        UILabel *titleViewLable = [[UILabel alloc] init];

        

        titleViewLable.numberOfLines = 0;

        titleViewLable.textAlignment = NSTextAlignmentCenter;

        

        CGFloat titleViewLabelLeft = 0;

        CGFloat titleViewLabelTop = 10;

        CGFloat titleViewLabelWidth = 200;

        CGFloat titleViewLabelHeight = 100;

        

        titleViewLable.frame = CGRectMake(titleViewLabelLeft,

                                          titleViewLabelTop,

                                          titleViewLabelWidth,

                                          titleViewLabelHeight);

        

        NSString *controllerTitle = @"发微博";

        NSString *name = @"Evan少";

        NSString *titleViewLbelStr = [NSString stringWithFormat:@"%@ %@",controllerTitle,name];

        titleViewLable.text = titleViewLbelStr;

        NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:titleViewLbelStr];

        

        [attrStr addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:16] range:[titleViewLbelStr rangeOfString:controllerTitle]];

        

        [attrStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:12] range:[titleViewLbelStr rangeOfString:name]];

        

        titleViewLable.attributedText = attrStr;

        

        self.navigationItem.titleView = titleViewLable;

    }

  • 相关阅读:
    ACL2019对话、问答相关论文整理
    docker for windows添加卷映射
    聊聊多轮任务型对话那些事
    创建用户故事地图(User Story Mapping)的8个步骤
    关于如何做出好的产品
    知识体系整理
    关于如何做好需求的方法
    使用rasa搭建聊天机器人
    【转载】指代消解笔记
    计算机相关会议排名(一)
  • 原文地址:https://www.cnblogs.com/happyEveryData/p/5514289.html
Copyright © 2020-2023  润新知