1、UIApplication的keyWindow被標記爲API_DEPRECATED,獲取的爲nil
修改爲[[[UIApplication sharedApplication] windows] objectAtIndex:0]
2、OS13中通過KVC方式來獲取私有屬性,有Carsh風險,訪問私有變量崩潰,比如 UITextField * searchField =[_searchBar valueForKey:@"_searchField"];
在13中把SearchBar中的textField直接暴露給開發者使用,直接使用self.searchTextField;
if ([self.textfield respondsToSelector:@selector(setAttributedPlaceholder:)]) {
UIColor *color = kHBColorManager.kColorThreeLevelText;
self.textfield.attributedPlaceholder = [[NSAttributedString alloc] initWithString:placeholder attributes:@{NSForegroundColorAttributeName: color}];
} else {
self.textfield.placeholder = placeholder;
}
禁止使用 [UITextField setValue:[UIColor redColor] forKeyPath:@"_placeholderLabel.textColor”];修改爲attributedPlaceholder