Share sheet Cancel buttons invisible swift - cancel-button

Is anyone else running into this problem. I recently noticed that the cancel/save buttons on the share sheets are now white making them impossible to read.
I've tried changing the navigation bar color but that doesn't even seem to work so clearly I'm missing something else.
This still works properly on devices running IOS 10 but having issues with devices running IOS 11
messanger
Mail
Notes
Twitter

I've ran into similar issues. It seems like title text attributes set on UINavigationBar get passed down to the UIActivityViewController from iOS 11 on.
So something like this:
let barButtonItemTextAttributes = ...
let barButtonItemAppearance = UIBarButtonItem.appearance(whenContainedInInstancesOf: [UINavigationBar.self])
barButtonItemAppearance.setTitleTextAttributes(barButtonItemTextAttributes, for: UIControlState())
... affects the sharing sheets as well. In my case, the foregroundColor attribute was set to .clear to disable Back button labels on the navigation bar, but it also removed the above mentioned cancel/save buttons.
Maybe this applies to your case as well.

Related

Duplicate Title Text when placing GooglePlaces SearchController into NavigationItem in iOS 13

I have an iOS app that uses GooglePlaces API. I use the "Add a Results Controller" technique to implement the search bar, but instead of assigning the searcher to the navigationItem.titleview like so:
navigationItem.titleView = searchController?.searchBar
I assign the searchController to the navigationItem.searchController like this:
navigationItem.searchController = searchController
This has worked for me up until iOS 12.4. I don't like the way it looks when the searcher is in the titleView.
Now in iOS 13.x this results in duplicated title text which can be seen in the attached images.
This duplicate appears when the search bar has been activated then Cancelled or when the focus moves to another control. When you pull down on the underlying table, you can see the duplicate in the live app.
It also causes the Search page title to bleed through when you navigate to the detail page. I don't know if this is a GooglePLaces API issue or an iOS 13 issue, but it causes my app to be rejected from the app store.
If anybody has seen this behavior please let me know. i have a sample project that shows the behavior.
I've been struggling with the very same issue. It's definitely a problem with UISearchController.
For now, what's known is:
It can be avoided by setting searchController.hidesNavigationBarDuringPresentation to true (thanks to Chris' comment).
If you absolutely must have searchController.hidesNavigationBarDuringPresentation to be set to false, you can manually remove offending labels as in this answer.
Finally, it's been reported that iOS 13.2 fixes that bug.
For more details see this question.
P.S. It was so hard to find any info about that bug, so I decided to collect all available clues in one answer for all of those who's faced the same problem.
This has been fixed with iOS 13.2

UISearchBar in iOS 13 have small black spot next to the dismiss (x) button

In iOS 13 we're seeing this bug when using the UISearchBar (via. the UISearchController. Next to the dismiss button (x) there is a small black fragment.
The issue was not present in iOS 12.4.
Using the UI debugger I've identified the issue is caused by us localising the "Cancel" string ourselves (because we want to translate the app in more languages than supported by the Apple System UI), using the following code:
UIButton.appearance(whenContainedInInstancesOf: [UISearchBar.self])
.setTitle("Cancel", for: .normal)
Per comments, https://stackoverflow.com/a/58040862/95309 have a fix:
UIBarButtonItem.appearance(whenContainedInInstancesOf: [UISearchBar.self]).title
The difference between the UIButton.appearance and UIBarButtonItem.appearance seems to been the culprit.

UIBarButtonItem tintColor issue while setting bold text on in accessibility

UIBarButtonItem tintColor is not getting change after setting Bold Text On in Settings -> Display & Brightness -> Bold Text.
i am facing this issue in iOS 11 & 12 both. haven't checked in previous versions.
The same question is already asked in apple developer forum but i didn't find any answer there.
https://forums.developer.apple.com/thread/89337
if some one have any work around to this please suggest me.
You can try to do it programmatically using NSAttributedString, I have never done it trough the storyboard, but programmatically using array of [NSAttributedString.Key.font: .systemFontOfSize(size: 25), NSAttributedString.Key.foregroundColor: .blue], etc., works like a charm.
One method that works for me is changing the Global Tint option on the storyboard, of course this is not the perfect solution.

TWTRComposer showing invisible Share and Cancel buttons

I am using TWTRComposer to create a share dialogue within my iOS app. However, when the composer shows up, you don’t see the Cancel or Tweet buttons showing at all. After tapping around on the top left and right corners, I learned that the buttons are there but not clearly visible. Here is a screenshot pointing out what I am talking about:
Is anyone else experiencing this? and if so, do you guys know if a fix for this is in place or how to work around this? I cannot update my app in this state as it will provide a bad Twitter experience.
I also tried using TWTRComposerViewController but came to the same issues.
Thanks
NVM, I found out that I was setting the UIBarButton tint color to white in some other place in my app for another class. So I had to set it back to Twitter color before showing twitter
[[UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:#[[UINavigationBar class]]] setTintColor:UIColorFromRGB(0x3EA1EC)];
Using Fabio Gomez's answer.
Solution for Swift 4.2 :
UIBarButtonItem.appearance(whenContainedInInstancesOf: [UINavigationBar.classForCoder() as! UIAppearanceContainer.Type]).setTitleTextAttributes([NSAttributedString.Key.foregroundColor : UIColor.black], for: .normal)

setTitleTextAttributes not working after view on screen. iOS 11

I've spent a whole day trying to change the colour of a UIBarButtonItem and now i'm thinking it is an iOS 11 bug unless someone can tell me it's by design.
I can change the colour of the text by using this code
[self.refreshButton setTitleTextAttributes:#{NSForegroundColorAttributeName: [UIColor orangeColor]} forState:UIControlStateNormal];
If I add the code to the viewWillAppear:animated function it works fine, however if you add it to viewDidAppear:animated it does not work.
It seems to work on the iOS 9 simulator, but not iOS 11.
Has something changed in this regard in iOS 11?
If all you want to do is change the title color of your UIBarButtonItem you can set the tintColor property instead of setTitleTextAttributes:. If you want all of your UIBarButtonItems to have the same title color you can set the tintColor of your tool/navigation bar.
I had the same issue on iOS11 but needed to set the font by setTitleTextAttributes. Unfortunately this does also not work by appearance. The only solution I found was to create new BarButtonItems as copy of the old ones and then set them as navigationItem.rightBarButtonItems.
For reference for other users having the same issue.
This Stack Overflow answer may explain why the method doesn't work.
An improper setting of UIControlState() may be the problem.

Resources