iOS 13 適応#
- UIViewController Present されたスタイルの変更
iOS 13 のデフォルトの modalPresentationStyle は UIModalPresentationAutomatic であり、私たちの要求に合わない可能性があります。以前のモードに戻すには UIModalPresentationFullScreen を使用します。
新しい UIViewController の Category を作成し、modalPresentationStyle の戻り値を変更します。
@implementation UIViewController(Category)
- (UIModalPresentationStyle)modalPresentationStyle {
return UIModalPresentationFullScreen;
}
@end
- “NSGenericException” -reason: “UITextField の_placeholderLabel ivar へのアクセスは禁止されています。”
TextField の placeholder の色を iOS 13 で設定するとクラッシュします。以下のメソッドは崩壊します。
[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];