NSString *aString = @"哈哈标题(必填)";
NSRange range = NSMakeRange(4, 4);
//当然也可以查找NSRange range = [aString rangeOfString:@"(必填)"];
NSMutableAttributedString *tempString = [[NSMutableAttributedString alloc] initWithString:aString];
[tempString addAttribute:NSForegroundColorAttributeName value:[UIColor grayColor] range:range];

除了

NSForegroundColorAttributeName 颜色,还有其他属性

NSFontAttributeName 字体UIFont

NSParagraphStyleAttributeName 段落风格等...

其他的自己可以去找找看看

最新文章

  1. [更新设计]跨平台物联网通讯框架ServerSuperIO 2.0 ,功能、BUG、细节说明,以及升级思考过程!
  2. CDH离线数据导入solr:利用MapReduceIndexerTool将json文件批量导入到solr
  3. FilterControl 显示时间并精确到时分秒的方法
  4. 山东省选 郁闷的小J
  5. ubuntu14.04下配置使用openCV3.0
  6. Two-Phase Commit (两阶段提交)
  7. search in 2d matrix and serach minimum in rotated array
  8. PYTHON多进程并发WEB服务器(利用LINUX的FORK)
  9. CMOS Sensor的调试经验分享
  10. Linux动态库的编译与使用
  11. VS2008生成的程序无法在其它电脑上运行,提示系统无法执行指定的程序
  12. PHP安装和配置
  13. (转)OpenGL中位图的操作(glReadPixels,glDrawPixels和glCopyPixels应用举例)
  14. C#之简单选择排序
  15. 理解iOS 8中的Self Sizing Cells和Dynamic Type
  16. Upgrade Ver 4.3.x from 4.2.x
  17. 安卓TextView限定行数最大值,点击按钮显示所有内容
  18. CSS3动画--过渡效果
  19. OI用语一览表
  20. echo与print,var_dump()和print_r()的区别

热门文章

  1. 将IoTdb注册为Windows服务
  2. pycham debug 专辑
  3. Array.from() ------来自❀ 前端宇宙 ❀公众号。
  4. STL关联式容器使用注意、概念总结
  5. python导入和导出excel,以文件流形式返回前端
  6. P22_条件渲染
  7. P20_事件绑定
  8. 接入jira OAuth权限流程
  9. git操作出现 error: The following untracked working tree files would be overwritten by ...
  10. 微信小程序wxs封装使用以及公共js组件封装