Why are disabled UISegmentedControl segments drawn incorrectly on iOS 4.0+? - iphone

For some strange reason, on iOS 4.2.1 (and any iPhone OS after 4.0), using a UISegmentedControl as a UIBarButtonItem in a toolbar will leave disabled segments drawn incorrectly, like this:
The text is displayed in dark gray, but should resemble the disabled state of the disabled "Login" button in the upper right. I'm using a standard UISegmentedControl, not a subclass.
Is there any way to get around this bug?
UPDATE: It's definitely not supposed to look that way and is probably a regression indroduced in iOS 4.0. Here's how it looks on 3.1.3:

Related

UIButton has strange unexpected bakground color on different device

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...

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.

How can I remove the glossy effect on a UITabbar?

I don't want the glossy selection that is on a standard UITabBar. Is there a way to remove the shine, and possibly add background texture instead of the black?
If your application is to be released on iOS 5, with no backward compatibility needed; goto to http://developer.apple.com and have a look, something on the iOS 5 beta pages might peek your interest :).
Otherwise you need to subclass UITabBar or make an equivalent replacement that draws using your custom needs.

The custom UIAlertView works fine in the IOS 4.0 but it shows the default bounding box for the ios 4.2

The custom UIAlertView works fine in the IOS 4.0 but it shows the default bounding box for the ios 4.2 .Do anybody know why this happens for my customised alertview
If you've customized a UIAlertView by traversing the private view hierarchy and altering elements there, there is no guarantee that your code will work correctly between OS updates. This is exactly why Apple tells you not to do this.
If you need to have something that looks like a UIAlertView, but has your own custom controls, I drew a replica of this view using Quartz in a sample application here.

MPMoviePlayer Default Control Buttons are unaligned

I have an MPMoviePlayer, which need to work on all iOS from 3.1 and forward. I modify the showing of controls based on the iOS version but I always use the default controls (i.e. setting control style for iOS 3.2 and 4 models, and control mode for 3.x versions).
A strange issue happens on the iOS 3.2+ MoviePlayer. The Rewind button is displaced some 5 or ten pixels up making it unaligned with the rest of the buttons.
Ok so in this case it turned out that my attempt to change content type and controlStyle didn't turn out very well. One solution I found if this issue appears is to create a completely new instance of the MPMoviePlayer and setting up the controlStyle accordingly...