iOS 13 適応#
転送元iOS 13 の落とし穴記録
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];