반응형
이번에 운영중인 앱에 네비게이션 바의 색이 특정 디바이스 OS 버전에서 검은색으로만 변경 되는 현상이 발생 했다.
기존에 적용 된 소스는 아래와 같다.
UIColor *color = [CommonUtil getColor:@"A7866B"];
[self.navigationController.navigationBar setBackgroundImage:[ImageUtil imageFromColor:color] forBarMetrics:UIBarMetricsDefault];
_statusView.backgroundColor = color;
해당 소스가 새로운 버전 에서 동작하지 않아서 발생한 문제 여서 검색한 결과 iOS 13.0 이 사용 한 디바이스는 다른 방식으로 적용을 해줘야 한단다.
대략적인 내용은 아이폰 정책이 바뀌면서 상단 네비게이션이 콘텐츠가 스크롤 될 때 투명도가 조절 되는 등 여러가지 인터렉션에 대한 정책이 추가 되어 위에꺼만 적용 했을 경우에는 반영이 안되는거 같았다.
적용한 소스는 아래와 같다.
if (@available(iOS 13.0, *)) {
UINavigationBarAppearance *appearance = [[UINavigationBarAppearance alloc] init];
appearance.titleTextAttributes = @{NSForegroundColorAttributeName: [UIColor whiteColor]};
appearance.backgroundColor = [CommonUtil getColor:@"A7866B"];
self.navigationController.navigationBar.standardAppearance = appearance;
self.navigationController.navigationBar.scrollEdgeAppearance = appearance;
}
13.0 사용가능한지 체크 후 해당 기능을 적용 시켜 주면 된다.
+ 위에 소스로만 적용을 했더니 기존 네비게이션 과 콘텐츠 사이에 간격이 발생 했다!!!!
다른 페이지에서 넘어 오게 되면 공통으로 사용 중이던 네비게이션에 오류가 발생하는것 처럼 보인다.
(아이폰쪽은 어렵네 ㅠ)
기존 네비게이션의 소스를 원상 복구 한 뒤 viewWillAppear 소스 안에 해당 소스를 넣어서 해결 했다.
'아이폰(xcode)' 카테고리의 다른 글
[Xcode]WKWebview before ios 11.0 was broken 해결방법 (0) | 2022.06.21 |
---|---|
[아이폰개발] 아이폰 스키마로 앱 호출 할 때 오류(Could not signal service com.apple.WebKit.WebContent) (0) | 2022.02.07 |
[objective-c] addsubview 사이즈 오류 (0) | 2022.01.27 |
네이버아이디로그인 중 오류 : Unable to log in appname (0) | 2022.01.04 |
네이버 로그인 구현중 테스트 앱 빌드 오류 (0) | 2021.12.31 |