iOS 13 适配#
- UIViewController Present 出来的样式修改
iOS 13 默认的 modalPresentationStyle 是 UIModalPresentationAutomatic,可能不符合我们的要求,改回之前的模式要用 UIModalPresentationFullScreen.
新写一个 UIViewController 的 Category,改变 modalPresentationStyle 的返回结果
@implementation UIViewController(Category)
- (UIModalPresentationStyle)modalPresentationStyle {
return UIModalPresentationFullScreen;
}
@end
- “NSGenericException” -reason: “Accress to UITextField’s _placeholderLabel ivar is prohibited.”
设置 TextField 的 placeholder 颜色在 iOS 13 Crash,即下面的方法会崩溃
[textField setValue:[UIColor whiteColor] forKeyPath:@"_placeholderLabel.textColor"];
修改:
#import <objc/runtime.h>
Ivar ivar = class_getInstanceVariable([UITextField class], "_placeholderLabel");
UILabel *placeholderLabel = object_getIvar(textField, ivar);
placeholderLabel.textColor = [UIColor whiteColor];