UIButton has strange unexpected bakground color on different device - swift

I've recently been building an app under iOS 15 (latest as of writing this code), and when I shipped a version of my app to test flight, one of my users sent me a video of the app working, and I noticed, all of my buttons have this strange background highlight effect. Is this some sort of accessibility mode? I've never seen this happen before. In included some screenshots below and the interface builder, there are no custom classes associated to this UIButton. And ALL of the buttons have this effect happening to them.
This other device has a strange background color attached:
But this is how its designed and how it shows up on my device and the simulator:
Here is a screenshot from Interface Builder:

I had a similar problem.
Change the style to default.
And then instead of the tint color, choose the text color.
The background can remain default.. and is therefore transparency.
Tested, works.
Example

Turns out my user had something in iOS accessibility settings turned on, called "Button Shapes". I had no idea...

Related

How to support dark mode in splash screens?

I am trying to support dark mode in a splash screen, which means that I am using a named color inside the LaunschScreen.storyboard file, but I have this error:
Named colors do not work prior to iOS 11.0.
Clearly the problem is that named colors work only in the newer versions of iOS, but there is no easy fix for that. I tried to create a custom view and set the color there, but I just found out that it's not allowed to use custom classes in launch screens. For now the only solution that comes to my mind is to create two separate targets, one for iOS 11+, one for the lower versions but it's a bit overkill and I don't like the idea. Apparently there is no recommendation from Apple on how to support dark mode in launch screen (or at least I couldn't find anything). Any suggestion?
Use systemBackgroundColor for the main view background color.
You can change in Storyboard GUI (no code needed) automatically the system will set the right color in iOS13 and white for previous iOS versions.
PS: for other colors you can use System xxxx Color for standards.
As you said named colors will not work below iOS 11.
[alternative] So, you can create an Image View in Launch screen and set a dark appearance for that image like below.
You can apply your colors in that image.

Make sidebar widget transparent on macOS Mojave

I have two apps for macOS Mojave that come with an extension for the sidebar.
I have noticed that the app extension looks different in the Widget Simulator and the sidebar. When the app runs in the Widget Simulator, the background has some transparency. When I run the app normally, there is no such transparency. I have attached two screenshots:
As you can see, the app has no transparency (compare to the calculator app of macOS).
The second screenshot shows the app running in the simulator with transparency.
Are there any options that I have to set to make it transparent? Is there a new type if NSView descendant? The title bar is also different, so I don't think it is enough to simply set the background color to "clear". The latest version of the app is built for 10.14 only, so I don't care if the solution is only available for macOS Mojave.
I have checked, that the widget inherits the appearance of the super view/window. I did not change any other properties. I also tried using a NSVisualEffectView with various settings, but this also did not solve the problem.
Regards
I just found a solution in the Apple Developer forums:
Apple Developer Forum
In the info.plist file of the extension, there is a section called NSExtension. In there, the NSExtensionAttributes/NSExtensionPointVersion had to be incremented (was 2.0, now is 3.0).
Now the app extension looks nice:

How to change the background color of keypad in iOS 7

I am using Xcode 5 for developing applications. I want to change the color of keyboard in iOS 7. I want a color like black or blue.
How can I change the color of keyboard in iOS 7?
You can only set the keyboard appearance to any of three listed below using the UIKeyboardAppearance.
UIKeyboardAppearanceDefault // Corresponds to the UIKeyboardAppearanceLight
UIKeyboardAppearanceDark // Available in iOS 7.0 and later.
UIKeyboardAppearanceLight // Available in iOS 7.0 and later.
There is one more constant named UIKeyboardAppearanceAlert but, that is now deprecated. You should use UIKeyboardAppearanceDark instead.
You can't use any custom or undefined color.
So, Use ...
myTextfield.keyboardAppearance = UIKeyboardAppearanceDark;
In iOS 7, since the keyboard is translucent, I was able to accomplish this effect by adding a colored subview behind the keyboard that shows and hides with keyboard notifications.
I created a GitHub project to demonstrate this technique. Keep in mind it only works in portrait orientation right now and obviously only in iOS 7.
https://github.com/meekapps/TintedKeyboard
You can change the color with the keyboardAppearance method.
_textField.keyboardAppearance = UIKeyboardAppearanceDark;
Have a look at the Apple API docs
Per your comment of wanting a custom color:
You could do this... Just use the normal keyboard, then observe UIKeyboardWillShowNotification and UIKeyboardWillHideNotification so that you can show a color UIView behind the keyboard.
It would be hacky, but it would work because the default keyboard is transparent to a degree on iOS 7.
Good luck.

Transparent iphone application

I'm trying to build an application that is launched has a transparent background, in practice, showing only the objects in view (buttons, labels etc etc) but not the background so you can see the background the user's home.
In the example file you can see the purple square image at the center of the screen, in theory should be a normal UIView with a picture in the center but does not see the background of UIWindow/UIView.
Is possible to realize such a thing? Can anyone help me?
thanks
No. It's not possible using the official SDK. I'm interested to know why you would want to do this?
It might be possible, try setting the window background color to clear, as well as the view controller's view background color.
I say it might be possible because I've seen my home screen while using some apps, for example, the Facebook app sometimes shows it during a transition (it might be a bug on either Facebook or the OS).
Anyway, I'm pretty sure that kind of app would be rejected from the App Store, so be advised.

Correct colour display of Default.png on iPhone

I'm using the Default.png method to create a splashscreen. I'm using the same file for my background and the Default.png (except default.png has the 20 pixel status bar at the top).
However, the iphone isn't displaying them in them the same. The Default.png is being displayed darker than the background, so it's painfully obvious when the app is loaded.
As a visual example of what I mean, please see below:
The image on left is the Default.png whereas the image on the right is when the app has loaded. The difference looks subtle here but when the whole image changes, it looks quite drastic.
Is this an issue with the colour-formatting of the pngs? Or is this an iOS feature whereby the Default.png appears slightly darker anyway?
It's probably not worth mentioning but I'm using Monotouch to develop my app, I doubt that would have anything to do with this.
I had a problem like this after editing a screenshot with OSX's Preview to cut out the status bar (as needed for iPad splashes). Preview sticked a color profile, and splash screen appears darker than the real thing in device.
If you open the image with GIMP, it shows a dialog offering to convert the color profile to SRGB. Take it (press "Convert") and save the image. This fixes the color difference.
Solved the problem. The designer sent me new versions of the backgrounds and the Default.png is now displaying the correct colour.
I have a feeling I had saved the previous version with a different colour profile to the background, hence why it was being displayed differently.