UIActivityViewController共享消息取消未显示

问题描述 投票:2回答:1

当我想通过UIActivityViewController与消息应用程序共享URL时。取消按钮是白色的(我猜因为它仍然可以点击)

它只出现在iOS 11上,这里的代码用于呈现UIActivityViewController,我已经尝试在呈现UIActivityViewController之前更改颜色,但按钮保持白色:

if #available(iOS 11.0, *) {
   UIButton.appearance(whenContainedInInstancesOf:[UINavigationController.self]).tintColor = .blue
}

这里的代码用于呈现UIActivityViewController

let vc = UIActivityViewController(activityItems: [article.webReference], applicationActivities: [])
        self.present(vc, animated: false, completion:nil)

        vc.completionWithItemsHandler = {(s, ok, items, error) in
            switch s {
            case UIActivityType.mail?:
                print("mail")
                AnalyticsHelper.sharedInstance.sendShareMailEvent(articleUrl: article.webReference)
            case UIActivityType.postToFacebook?:
                print("facebook")
                AnalyticsHelper.sharedInstance.sendShareFacebookEvent(articleUrl: article.webReference)
            case UIActivityType.postToTwitter?:
                print("twitter")
                AnalyticsHelper.sharedInstance.sendShareTwitterEvent(articleUrl: article.webReference)
            default:
                print("others")
            }
        }
ios swift3 ios11 uiactivityviewcontroller
1个回答
0
投票

由于UIBarButtomItem.apperance(),我遇到了同样的问题.tintColor已更改。我没有改变默认的UI外观,而是创建了我的NavigationController类,它继承自UINavigationController,在viewDidLoad方法中我自定义了我需要的东西。接下来,我将故事板和纯代码中的所有UInavigationController用法更改为NavigationController。现在我可以在AppDelegate中更改此类的控件,例如:

let navBarButton = UIBarButtonItem.appearance(whenContainedInInstancesOf: [NavigationController.self])
navBarButton.tintColor = .white
© www.soinside.com 2019 - 2024. All rights reserved.