0

當我使用UIActivityViewController與WhatsApp共享文本時,共享的第二個屏幕具有錯誤的按鈕顏色。第一個屏幕是確定的。這個問題已經討論了很多的時間和答案的一個很大的水桶可以在這裏找到:當通過UIActivityViewController與WhatsApp共享時,按鈕中的textColor錯誤

但由於某種原因不是第二個。

此爲第一個屏幕的修補程序:

[[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTintColor:[UIColor whiteColor]]; 

但是,即使將所有UIBarButtonItems的外觀不工作:

[[UIBarButtonItem appearance] setTintColor:[UIColor whiteColor]]; 

示例代碼不工作:

 self.window?.tintColor = UIColor.white 
     let activityController = UIActivityViewController.init(activityItems: items, applicationActivities: nil) 

     if let vc = delegate?.currentViewController() { 
      sender.isEnabled = false 

      vc.present(activityController, animated: true, completion: { 
       sender.isEnabled = true 
      }) 
      activityController.navigationController?.navigationBar.tintColor = UIColor.white 
      activityController.view.tintColor = UIColor.white 

屏幕截圖:

第一個屏幕(OK) Whatsapp first screen (OK) 第二個屏幕(不正常) Whatsapp second screen (NOT OK) 股份通過e-mail(OK) Email (OK)

回答

1

只需通過改變嘗試的UIWindow的tintColorAppdelegate方法didFinishLaunchingWithOptions。它會自動將其默認傳遞給它的所有UIView後代。

[self.window setTintColor:[UIColor whiteColor]]; 

希望這會幫助你。

這也可能是第三方的問題,它將(重寫)再次設置tintColor。

+0

不工作。我已經添加了代碼我測試了 –

+0

@SjoerdPerfors這也可能是第三方會覆蓋此設置的問題。 –

相關問題