feat: 初始化

This commit is contained in:
杭城小刘
2018-09-11 10:11:39 +08:00
committed by 杭城小刘
commit 8e5d2c9e7f
264 changed files with 12082 additions and 0 deletions

35
第一部分 iOS/1.24.md Normal file
View File

@@ -0,0 +1,35 @@
# 修改 UITextField 的 placeholder样式
> 对于 UITextField 的 placeholder 私有属性来说 Apple 不允许我们直接修改但是按照经验我们有2种方式可以实现自定义 placeholder 的样式
### 1、利用 KVC 对 UITextField 的私有属性修改
```
[self.invitecodeTextfield setValue:[UIColor redColor] forKeyPath:@"_placeholderLabel.textColor"];
[self.invitecodeTextfield setValue:[UIFont systemFontOfSize:35] forKeyPath:@"_placeholderLabel.font"];
```
### 2、利用 Apple 提供的 API 进行修改
UITextField 有个属性 attributedPlaceholder利用它我们可以修改 placeholder 的样式
```
self.invitecodeTextfield.attributedPlaceholder = [LBPHightedAttributedString setAllText:@"我要Testing" andSpcifiStr:@"Testing" withColor:[UIColor redColor] specifiStrFont:[UIFont systemFontOfSize:17]];
```
其中 **LBPHightedAttributedString** 是我封装的一个关于 NSMutableAttributedString 的工具,可以对一个指定的字符串内部的字符串进行全局查找并高亮设置的小工具,具体可以查看地址
[LBPHightedAttributedString](https://github.com/FantasticLBP/BlogDemos/tree/master/LBPAttributedStringTools/LBPHightedAttributedString "LBPHightedAttributedString")