1.通过KVC方式修改UITextField空白提示语颜色 崩溃 - (比较常见)
崩溃代码
UITextField *T = [[UITextField alloc] initWithFrame:CGRectZero];
[T setValue:[UIColor redColor] forKeyPath:@"_placeholderLabel.textColor"];
解决方法
UITextField *T = [[UITextField alloc] initWithFrame:CGRectZero];
T.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"请输入手机号" attributes:@{NSForegroundColorAttributeName : [UIColor redColor]}];
额外延伸搜索的问题,普片都是复制 _placeholderLabel.textColor 代码进行全局搜索,但是可以包含第三pod的框架里面的文件 ,所以搜索需要添加筛选
在三个不同文件夹分别创建不同的文件,填入相同的代码
换句话说,它会搜索出结果 整个项目文件,很不友好。添加筛选条件
1.控制器通过presentViewController方式跳转样式变更 - (比较常见)
目前iOS 13所 显示界面,顶部有一块上一级顶部样式
解决方式一: 做一个UIViewController分类 (自由度不够高,跳转方式单一)
#import "UIViewController+iOS13.h"
@implementation UIViewController (iOS13)
- (UIModalPresentationStyle)modalPresentationStyle {
return UIModalPresentationFullScreen;
}
@end
解决方式二: 全局搜索 presentViewController 针对控制器的跳转进行修改- (个人推荐)
TwoViewController *vc = [TwoViewController new];
vc.modalPresentationStyle = UIModalPresentationAutomatic;
[self presentViewController:vc animated:YES completion:nil];
1.暗黑模式适配
- 如果需要暗黑模式:需要设计师预先给APP界面做两套设计
- 如果不需要暗黑模式:需要在项目的Info.plist文件添加 key: User Interface Style, value:Light