2017-10-13 4 views
3

Xcode 8.3으로 프로젝트를 시작했으며 iOS 10까지는 괜찮 았지만, iOS 11에서 동일한 앱을 실행하면 뒤로 버튼이 원하는대로 정렬되지 않았습니다.iOS 11에서 뒤로 버튼이 제대로 정렬되지 않았습니다.

iOS 11 screenshot

아래 그러나 아이폰 OS 10의를 가진 이미지가 제대로

iOS 10 Screenshot

정렬 그리고 이것은 우리가

01,235,164을 받고 레이아웃 제약 조건 오류 나는 우리가 그렇게 안 제목을

UIBarButtonItem.appearance().setBackButtonTitlePositionAdjustment(UIOffsetMake(0, -1000), for: .default) 

을 숨기기 위해 다음과 같은 몇 가지 트릭을 사용하기 때문에

(
"<NSLayoutConstraint:0x600000288200 _UIModernBarButton:0x7f7ef5c87f10.bottom == UILayoutGuide:0x6000005a0380'UIViewLayoutMarginsGuide'.bottom + 64.5 (active)>", 
"<NSLayoutConstraint:0x600000287f30 V:[_UIModernBarButton:0x7f7ef5c87f10]-(>=0)-| (active, names: '|':_UIButtonBarButton:0x7f7ef5c86e60)>", 
"<NSLayoutConstraint:0x600000282030 'UIView-bottomMargin-guide-constraint' V:[UILayoutGuide:0x6000005a0380'UIViewLayoutMarginsGuide']-(16)-| (active, names: '|':_UIButtonBarButton:0x7f7ef5c86e60)>" 

)

답변

3

는 나에게 그것은 아이폰 OS 11에서 작동하지 않습니다와 많이 트리거입니다 귀하가 게시하는 것과 같은 자동 레이아웃 문제가 있습니다. 다시 버튼에 appearance이 있는지 확인하십시오.

당신이 정말로 뒤로 버튼에 텍스트를 숨기려면, 당신은 https://stackoverflow.com/a/46889050/1418457

1
UINavigationBar.appearance().backIndicatorImage = image.withRenderingMode(.alwaysOriginal) 
UINavigationBar.appearance().backIndicatorTransitionMaskImage = image.withRenderingMode(.alwaysOriginal) 

    if #available(iOS 11, *) { 
     UIBarButtonItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.clear], for: .normal) 
     UIBarButtonItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.clear], for: .highlighted) 
    } else { 
     UIBarButtonItem.appearance().setBackButtonTitlePositionAdjustment(UIOffset(horizontal: -60, vertical: -60), for: .default) 
    } 
+1

이전에 아이폰 OS (11) 장치에 대한 다른 조건을 제거, 여전히,이 코드가 작동해야한다. 그래서 다른 조건에 중대한 것이 무엇인지 알 수 있습니까? – g212gs

+0

for ios 11 미만 –

+0

예, 위 코드에서 알 수 있지만 다른 코드를 제거하면 여전히 iOS 10 기기가 적절한 UI를 사용합니다. – g212gs

관련 문제