zoukankan      html  css  js  c++  java
  • 例如微博发送微博导航条内容

    - (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;

    }

  • 相关阅读:
    AC自动机【学习笔记】
    SCOI2016 背单词【Trie树,贪心】
    【字符串算法】字典树Trie入门
    USACO 1.3 Name That Number【暴搜】
    MapReduce分组
    MapReduce排序
    博客园添加访问人数统计
    MapReduce的分区
    MapReduce的计数器
    MapReduce部分源码解读(一)
  • 原文地址:https://www.cnblogs.com/happyEveryData/p/5514289.html
Copyright © 2011-2022 走看看