iOS 15系統(tǒng) backIndicatorImage圖片設(shè)置失敗問(wèn)題修復(fù)方法
在iOS15之前,我們是這樣設(shè)置的
UINavigationBar *navigationBarAppearance = [UINavigationBar appearance];
navigationBarAppearance.backIndicatorImage = [UIImage imageNamed:@"image_common_navBackBlack"];
navigationBarAppearance.backIndicatorTransitionMaskImage = [UIImage imageNamed:@"image_common_navBackBlack"];
但是系統(tǒng)升級(jí)到iOS15之后佳遂,發(fā)現(xiàn)返回按鈕不是自定義的圖片了哈踱,設(shè)置失效,我們需要調(diào)整代碼如下
if (@available(iOS 15.0, *)) {
UINavigationBarAppearance *appearance = [[UINavigationBarAppearance alloc] init];
[appearance setBackIndicatorImage:[UIImage imageNamed:@"image_common_navBackBlack"] transitionMaskImage:[UIImage imageNamed:@"image_common_navBackBlack"]];
[[UINavigationBar appearance].scrollEdgeAppearance: appearance];
[[UINavigationBar appearance].standardAppearance:appearance];
}
通過(guò)set方法設(shè)置艘款,就可以發(fā)現(xiàn)返回按鈕的圖片替換成功了