1.定义RGB 色彩。随机颜色

我的抽为宏定义。便于各个文件中使用

// 1.获得RGB颜色
#define MTColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]


// 2随机颜色
#define MTRandomColor MTColor(arc4random_uniform(255), arc4random_uniform(255), arc4random_uniform(255))


//使用方法
 MTCollectViewController *collect = [[MTCollectViewController alloc] init];
     //随机色
    collect.view.backgroundColor = MTRandomColor;

    传入RGB颜色值 自定义纯色
    collect.view.backgroundColor = MTColor(255, 255, 255);
    [self addChildViewController:collect];

 

相关文章:

  • 2021-12-31
  • 2021-12-02
  • 2021-04-05
  • 2021-11-14
  • 2021-10-16
  • 2021-11-11
  • 2021-10-16
  • 2021-12-21
猜你喜欢
  • 2021-11-14
  • 2021-11-26
  • 2021-05-18
  • 2021-10-16
  • 2021-03-29
  • 2021-10-14
  • 2021-12-02
  • 2021-04-14
相关资源
相似解决方案