iOS 7 keyboard issue - ios

I am using iOS 7 for my application. In my app I have changed keyboard appearance to 'UIkeyboardApperanceAlert'. It makes keyboard black. But problem is when app comes from background to foreground, whenever I click in textField it first opens keyboard with white color and then it's color turns to black.
Why this is happening?

I found that setting autocorrectionType property to UITextAutocorrectionTypeNo resolves this issue!
self.myTextField.autocorrectionType = UITextAutocorrectionTypeNo;

UIKeyboardAppearanceAlert is Deprecated in ios7. Use UIKeyboardAppearanceDark instead.

This is a bug in iOS 7, I had feedback on Apple dev forums.
iOS 7 Keyboard color flash

Try this:
Declare the textField in your h. file.
On your viewDidLoad / viewDidAppear add this (after allocating and initializing ofcourse):
[(UITextField *)yourSubView setKeyboardAppearance:UIKeyboardAppearanceAlert];
Or
[yourTextField setKeyboardAppearance:UIKeyboardAppearanceAlert];

Related

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.

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

setBackgroundImage for UIButton in IOS 7.1 not working

I am trying to change the button background image. This code is working fine with IOS 6/7. After I upgrade to IOS 7.1 suddenly it is stop working.
[monday setBackgroundImage:[UIImage imageNamed:#"toggleTopRight"] forState:UIControlStateNormal];
BWT: the image is ok, because this code is being called in view will appear and this ok there ... when i press on the button that need to change the setBackgroundImage it's not working.
This is a bug on 7.1 SDK and Xcode 5.1.
The workaround is to call [UIButton setNeedsLayout] after your changes.
That should do the trick.
I had the same problem. I finally found out that setting a button's (background) image doesn't work on iOS 7.1, if the button is disabled.
Not sure if this fixes your problem, but it was mine. Calling setNeedsLayout didn't help in my case, unfortunately. What you can do as a workaround is either to override UIButton or to add a category that contains a method like the following to set an image:
- (void)setBackgroundImage:(UIImage *)img forButtonState:(UIControlState)state
BOOL shouldEnable = self.enabled;
self.enabled = YES;
[self setBackgroundImage:img forState:state];
self.enabled = shouldEnable;
}
Filed a bug report for this issue (16497031).
For me it's the foreground image that covered the background image. So make your foreground image transparent then the background image will show. Setting background image actually works fine now.

IOS 7 Button Background Does Not Work

I have a project that comes from IOS6, and now with the button changes of the IOS7 I had to make a background to my project buttons. Although, when I try to set a background image for my buttons it doesn't work! programming or not it doesn't work!
I tryied:
[buttonOutlet setBackgroundImage:[UIImage imageNamed:#"lineStyleScreen.png"] forState:UIControlStateNormal];
and the IDE! BOTH DONT WORK!!!
I wonder if it is because I did't updated my storyboard to IOS7.
ios 7 doesnt support regular ios 6 buttons. Do follow this link:
http://dev.iachieved.it/iachievedit/?p=127
Is the button type set to Custom in properties inspector?
Try to set the tint color to the button for iOS 7
button.tintColor = [UIColor greenColor];
Note:- set the tint color that will suit to your requirement

Back button is not visible in iOS 7

I have some weird trouble about iOS 7. I have an UINavigationBar in my app and it works perfect for iOS 6;
-- IOS 6 --
However, when i try to run it on iOS 7, my back button disappeared. It's there, still working and clickable but not visible;
-- IOS 7 --
How can I fix this problem ?
Setting BackButtonBackgroundImage via UIAppearance currently has some odd behavior in iOS 7. This is probably related to the updated design, which replaces the rect-style button with a backIndicatorImage (an arrow).
This leaves 3 options for customizing the back button's appearance:
Change the color of the backIndicatorImage by setting the tintColor property on UINavigationBar (or one of its superclasses).
Set the new backIndicatorImage property on UINavigationBar to a custom image. (don't forget to set the backIndicatorTransitionMaskImage as well or it won't work)
Create a custom UIBarButtonItem and manually assign it as UINavigationItem's leftBarButtonItem. (See the answer mentioned above by Mashhadi)
By the way, if you have to keep support ios 6 version like me, use that;
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1)
{
// My iOS 6 back button background
self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:39.0f/255.0f green:184.0f/255.0f blue:199.0f/255.0f alpha:1.0];
}
else
{
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
}
I used Wes Dearborn's answer and implemented a nice way of supporting both iOS5+'s back button and iOS7's backIndicatorImage:
Back button strangely disappearing in UINavigationController but keeps working

Resources