TWTRComposer showing invisible Share and Cancel buttons - ios

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)

Related

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.

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.

Share sheet Cancel buttons invisible swift

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.

Change color of send message bar (JSQMessagesViewController)

I am adding chat functionality to my app using JSQMessagesViewController. I am going with a dark theme and made the chat dark except for the send message bar. I have not been able to figure out how to change its color (See screenshot below). Can someone tell me how to change the color of the send message bar?
Thanks!
Here is how I changed it. Thanks Sargeras for the help.
self.inputToolbar.contentView.backgroundColor = UIColor.blackColor()

Change iOS System Keyboard Background Image and Buttons Image

Rather than creating a custom keyboard...how can I change the ios keyboard background image and get reference of the keyboard button or just the keyboard view programatically?
I do not want to replicate the whole ios keyboard, just tweak the keyboard here and there.
Solution Update:
You cannot update only the background or the buttons of the iOS System Keyboard! This is dues to the reason that Apple has limited the access to the Keyboard API. The most you can do is change the keyboard background color i.e. dark or light.
If you need to change the background to an image like me, you need to extend the ios keyboard i.e. make your own custom keyboard!
Please check below for accepted answer!
Hope this helps!
You can do something like this,
myTextField.keyboardType = UIKeyboardTypeDecimalPad; // many other options
myTextField.keyboardAppearance = UIKeyboardAppearanceDark; //many other options
If you want totally customize keyboard then refer this tutorial.
Hope this will help :)
For dark background you can use
mytextfield.keyboardAppearance = UIKeyboardAppearanceAlert;
For more customisation follow this link:
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITextInputTraits_Protocol/index.html

Resources