zoukankan      html  css  js  c++  java
  • 宏的简单应用

    http://blog.sina.com.cn/s/blog_4ca9ceef0101isv5.html

    http://www.cnblogs.com/zhw511006/archive/2013/03/28/2986355.html

    http://blog.sina.com.cn/s/blog_4ca9ceef0101isv5.html

    http://my.oschina.net/leejan97/blog/227303

    //没用#define前是这样的,每个ViewController都要写这么一段重复的代码 写多了就烦了

         /***********************处理前*****************************/

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

    titleLabel. backgroundColor = [ UIColor clearColor ];

    titleLabel. textColor = [ UIColor redColor ];

    titleLabel. text =  @"导航栏标题" ;

    titleLabel. font =[ UIFont fontWithName : nil size : 17.0f ];

    [titleLabel  sizeToFit ];

         self . navigationItem . titleView  = titleLabel;

    //在全局配置文件(config.h)中定义了一个宏

    #define SET_NAV_TITLE(_TITLE) ({

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

    titleLabel.backgroundColor  = [UIColor clearColor];

    titleLabel.textColor        = [UIColor redColor];

    titleLabel.text             = _TITLE;

    titleLabel.font=[UIFont fontWithName:nil size: 17.0f ];

    [titleLabel sizeToFit];

    self.navigationItem.titleView = titleLabel;

    })

    //定义了宏后就这么一句了

         /***********************处理后*****************************/

         SET_NAV_TITLE ( @"导航栏标题" );

  • 相关阅读:
    CF1036C Solution
    CF1041E Solution
    CF1043E Solution
    CF1054D Solution
    CF1032D Solution
    题解 P6194 【[EER1]苏联人】
    题解 CF1324A 【Yet Another Tetris Problem】
    题解 CF1325A 【EhAb AnD gCd】
    题解 CF1325B 【CopyCopyCopyCopyCopy】
    题解 AT5805 【Bishop】
  • 原文地址:https://www.cnblogs.com/chengjun/p/4958524.html
Copyright © 2011-2022 走看看