2017-11-09 7 views
0

컬러 텍스트는 NavigationController 텍스트에서는 흰색이지만 사용자가 공유 버튼을 누르면 (취소 버튼 표시) 흰색으로 변경됩니다. 그러나 사용자가 취소 버튼을 누르고 텍스트 작성에서 돌아 오면 색상은 그대로 유지되고 흰색으로 다시 변경되지 않습니다.UIActivityViewController에서 취소 버튼을 누르면 NavigationController 텍스트 색상을 변경하는 방법은 무엇입니까?

완료 처리기는 로그의 인쇄물을 볼 수는 있지만 색상은 변경되지 않습니다.

func completionHandler(activityType: UIActivityType?, shared: Bool, items: [Any]?, error: Error?) { 
    if (shared) { 
     print("Cool user shared some stuff") 
    } 
    else { 
     print("Bad user canceled sharing :(") 
     UIButton.appearance(whenContainedInInstancesOf: [UINavigationBar.self]).tintColor = .white 
     navigationController?.navigationBar.largeTitleTextAttributes = [ 
      NSAttributedStringKey.foregroundColor : UIColor.white 
     ] 
     navigationController?.navigationBar.titleTextAttributes = [ 
      NSAttributedStringKey.foregroundColor : UIColor.white 
     ] 

    } 

} 

답변

0

색조의 색상 변경과 관련된 완료 처리기와 모든 코드를 제거하고 검색 표시 줄에 다음을 추가했습니다. 지금 검색 창에 버튼을 클릭 색상은 흰색 취소하고 내가 메시지를 통해 내용을 공유 할 때 작곡 텍스트가 "취소"경우

UIBarButtonItem.appearance(whenContainedInInstancesOf: [UISearchBar.self]).tintColor = .white 

버튼 색상은 기본 (파란색)입니다.