UIKeyboard is not automatically displayed in iOS7

I understand that when developing in Xcode 5 with an iOS 7 project, the keyboard that appears when interacting with UITextField must be translucent and show any colors in the background. In both my projects this is not so. I have a color and blurry background, and I hope this happens through the keyboard; however, the keyboard remains white / gray by default.

This is what I have before the demo:

UIColor *tintColor = [UIColor colorWithWhite:0.21 alpha:0.4]; UIColor *background = [[UIColor alloc] initWithPatternImage:[[UIImage imageNamed:@"universe.jpg"] applyBlurWithRadius:19 tintColor:tintColor saturationDeltaFactor:1.8 maskImage:nil]]; self.view.backgroundColor = background; UITextField *text = [[UITextField alloc] initWithFrame:CGRectMake(200, 200, 300, 60)]; [self.view addSubview:text]; 

I even tried to set the keyboard appearance type for both UIKeyboardAppearanceDefault and UIKeyboardAppearanceLight

Can someone please tell me / tell me how can I achieve the effect of a translucent keyboard? Should it be automatic? thanks

EDIT 1:

I have an iPad mini, I have a 3rd generation iPad and a 4th generation iPad with retina displays. Launch iOS 7.0.2

+5
source share
3 answers

I created a simple testing program to try to find this problem, but I was not able to replicate it, except setting IPHONEOS_DEPLOYMENT_TARGET to a lower version number, for example 6.0, and then on iOS 6.0. In all cases, on all iOS 7 devices and the simulator, the keyboard by default has a translucent blur of the content below it.

Perhaps you could share a photo or sample project?

Set Xcode to target running on iOS 6.0 simulator

No translucency to the keyboard

Set Xcode to target running on iOS 7.0 simulator

Translucency to the keyboard

+1
source

Your code, setup, and example worked fine on my xCode. I first tried setting the background color to something obvious, like red.

 self.view.backgroundColor = [UIColor redColor]; 

It seemed from the keyboard. Subsequently, I tried the image without the blur effect.

 UIImageView* img = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"images.jpeg"]]; img.frame = self.view.frame; [self.view addSubview:img]; 

It showed up, but not as much as red, because the image that I used was like a galaxy, as you stated, and therefore there was a lot of black in it.

Finally, I tried your exact code, using the gaussian blur effect to create color.

 UIColor *tintColor = [UIColor colorWithWhite:0.21 alpha:0.4]; UIColor *background = [[UIColor alloc] initWithPatternImage:[[UIImage imageNamed:@"images.jpeg"] applyBlurWithRadius:19 tintColor:tintColor saturationDeltaFactor:1.8 maskImage:nil]]; self.view.backgroundColor = background; 

It worked too, but it was very hard to notice. The combined effect of dark colors, blurred once by a Gaussian and blurred keyboard again, made it almost invisible. I suggest you try a similar approach to see if you really get a transparent keyboard, because if the code and the information you provided is correct, then it seems like you and maybe you can't see them.

Also, the keyboard is slightly transparent, so if you expect full transparency, it is not. This little transparency is minimized than a more uniform background color, for example, if you had all black or white background, it would be imperceptible.

Edit: I confirmed that this is not the case on the iPad running iOS7.0.x. I get a standard gray keyboard, even using standard apps like Safari. It seems that Apple has not optimized transparency for such large screens, and this caused lag problems. It seems like this is partially fixed in iOS7.1, and there are more transparent iPad features in iOS7.1, but people recommend disabling them because they make the iPad run slower than usual.

+5
source

iOS 7.0.3 has reduced most of the transparency in navigation bars, toolbars, and the keyboard.

For navigation and toolbars starting with iOS 7.0.3, you can set the alpha property of the UIColor set to barTintColor if you want it to be more translucent.

As for the public APIs, the keyboard in iOS 7, however, still only has the following options:

 textField.keyboardAppearance = UIKeyboardAppearanceDefault; // the default (same as light) textField.keyboardAppearance = UIKeyboardAppearanceDark; // dark look (previously UIKeyboardAppearanceAlert) textField.keyboardAppearance = UIKeyboardAppearanceLight; // light look 

So, I assume that you are not getting the translucency you want because you are using iOS 7.0.3 or later. You can verify this by downloading the old version of Xcode and running your application in the simulator of this version .

As for private APIs, the keyboard background consists of UIKBBackdropView and UIKBBackgroundView . You can view their extracted header files here , but you should not modify them if you submit them to the App Store. (These changes are grounds for failure, and are also not documented, so they could be changed in any iOS update.)

+3
source

Source: https://habr.com/ru/post/954101/


All Articles