iosswiftwhatsappuiactivitycontroller

UIActivityViewController whatsapp share dialog white text background


I am using below code to share some content. When I choose whatsapp option, I am seeing white background behind the texts. I am totally lost because UIActivityController handles presenting the share dialog. Any idea how to remove the white background?

let vc = UIActivityViewController(activityItems: [text, url], applicationActivities: [])
self.present(vc, animated: true)

enter image description here


Solution

  • For some reason, it looks like the WhatsApp interface is applying a white background colour to UILabels. You could give this a try:

    let vc = UIActivityViewController(activityItems: [text, url], applicationActivities: [])
    UILabel.appearance(whenContainedInInstancesOf: [UIView.self]).backgroundColor = .clear
    self.present(vc, animated: true)