2014-10-01 5 views
1

내 앱의 화면 중 하나는 로컬 이미지의 미리보기를 보여 주며 문서 상호 작용 옵션을 표시하는 데 사용하는 왼쪽 상단 모서리에 작업 버튼이 있습니다.UIDocumentInteractionController는 탐색 모음 색조를 고려하지 않습니다.

- (IBAction)actionButtonTapped:(id)sender { 
    self.interactionController = [UIDocumentInteractionController interactionControllerWithURL:self.attachmentLocalUrl]; 
    self.interactionController.delegate = self; 
    [self.interactionController presentOptionsMenuFromRect:self.view.frame inView:self.view animated:YES]; 
} 

전자 메일로 첨부 파일을 보내는 전자 메일을 포함하여 옵션 목록이 포함 된 작업 시트를 보여주는 역할을하는이 방법은 잘 작동합니다. 이메일 버튼을 클릭하면 내 이미지가 포함 된 이메일 메시지의 미리보기가 표시됩니다. 하지만 작동하지 않는 한 가지가 있습니다. 내비게이션 막대가 앱 전체에서 같은 색상을 갖도록 내 앱의 모양을 맞춤 설정했습니다. 여기에 내 응용 프로그램 대리인의 didFinishLaunchingWithOptions에서 먼저 실행 코드입니다 :

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; 
[UINavigationBar appearance].barTintColor = [UIColor blueColor]; 
[UINavigationBar appearance].tintColor = [UIColor whiteColor]; 
[UINavigationBar appearance].titleTextAttributes = @{NSForegroundColorAttributeName: [UIColor whiteColor]}; 

이 내 자신의 뷰 컨트롤러 잘 작동하지만, UIDocumentInteractionController에 표시되는 이메일 미리보기 컨트롤러가 파란색 대신 흰색의 막대 버튼 항목이 있습니다. 다른 매개 변수가 올바르게 적용되었으므로 특히 탐색 모음의 파란색 배경은 취소 및 보내기 작업 단추가 거의 보이지 않습니다.

간단한 프로젝트에서 이것을 재연 해 보았습니다. 그러나 할 수 없었습니다. 그래서 분명히 정상적인 사용자 정의를 방해하기 위해 앱에서 뭔가를하고 있습니다. 그러나 나는 무엇을 알아낼 수 없다. 어떻게 내가 그것을 디버깅 할 수 있는지 어떤 생각?

+0

넌 할 수있어이 코드는 HTTP의 경우 전체 도움이 될 수 있습니다 : // 유래.COM/질문/26177142/만들 - 어 - 끈적 -보기 - 투 - 내비게이션 바을/26177826이 코드를 시도 할 수 있습니다 26,177,826 –

+0

# http://stackoverflow.com/questions/26177142/create-a-sticky -view-to-the-navigationbar/26177826 # 26177826 –

+0

같은 문제가 있습니다. 이 문제는 시뮬레이터가 아닌 기기에서만 발생합니다. –

답변

1

정확히 무엇을 의미하는지 명확히 할 수 있습니까? 네비게이션 바의 색이 문서 피커 또는 mfmailcomposer에서 망가 졌습니까?

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) 
{ 
    [[UIBarButtonItem appearance] setTintColor:[UIColor blackColor]]; 
    [[UINavigationBar appearance] setTintColor:[UIColor blackColor]]; 
} 

다음은 didPickDocument에 있던 색상으로 다시 변경 : 다음 중 하나를 내가 사용했던 그이지만 ...

는 UIDocumentPicker에 있다면

은 현재 호출하기 전에이 설정에 대한 몇 가지 코드는 그것은 MFMailcomposer 컨트롤러의 경우 didCancel 대표는

다음이를 사용

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) 
{ 
    [controller.navigationBar setTintColor:[UIColor blackColor]]; 
} 

희망이 0,123

하는 데 도움이
+1

옵션 메뉴에서 "메일"을 선택한 후 UIDocumentInteractionController에 의해 만들어진 MFMailComposeViewController에 있습니다. 따라서 네비게이션 막대의 색조를 강요하기 위해 뷰 컨트롤러에 대한 참조를 얻는 방법을 모르겠습니다. – Sebastien

0

UIDocumentController을 표시하기 전에 사용자 지정을 취소하고 UIDocumentController를 표시하는보기 컨트롤러 viewWillAppear()에 내 사용자 지정 테마를 복원하는 해결 방법으로 해결했습니다.

func launchDocumentController() { 
    UINavigationBar.appearance().titleTextAttributes = nil 
    UINavigationBar.appearance().barTintColor = nil 
    UINavigationBar.appearance().tintColor = nil 
    documentController.presentOptionsMenuFromRect(self.view.frame, inView: self.view, animated: true) 
} 

그런 다음

public override func viewWillAppear(animated: Bool) { 
    super.viewWillAppear(animated) 
    // Restore the reset bar colors 
    Theme.current.customizeAppearance() 
} 

OS 업데이트의 짧은, 나는 이것이 당신이 얻을하려고하는 최고의 '대답'라고 생각합니다. 죄송합니다. (내가 기회를 얻었을 때 나는 레이다 파일을 보낼 것이다.)

MFMComposeViewController에 직접 액세스하여 위에서 설명한대로 색조를 설정 한 경우에는 좋은 해결책이다. 여기

0

완벽하게 나를 위해 일한 것입니다 :

func documentInteractionControllerViewControllerForPreview(_ controller: UIDocumentInteractionController) -> UIViewController { 
    UINavigationBar.appearance().barTintColor = Colors.redColor() 
    UINavigationBar.appearance().tintColor = UIColor.white 
    UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName : UIColor.white, NSFontAttributeName: UIFont.systemFont(ofSize: 14, weight: UIFontWeightBold)] 
    return self 
} 
관련 문제