开发者

How do I make the keyboard associated w/ a UITextField have a transparent background?

开发者 https://www.devze.com 2023-03-30 12:45 出处:网络
I would like 开发者_Go百科the keyboard that is displayed when the user is typing in a UITextField to have a transparent background so the user can see the image under the keyboard. The keys would need

I would like 开发者_Go百科the keyboard that is displayed when the user is typing in a UITextField to have a transparent background so the user can see the image under the keyboard. The keys would need to remain non-transparent and just the background, i.e., gray filler color around the keys be transparent.


I've never tried to do what you want to do and I'm not sure you can make the standard keyboard have a transparent background however you should be able to create you own custom keyboard with transparent background as a view controller and then use the inputView property of the UITextField to replace the standard keyboard with your own custom one.

  1. Create a view controller with associated xib that functions as your custom keyboard.
  2. In the initialisation of the screen with the UITextView do something like

    MyCustomKeyboardViewController *kbvc = [[MyCustomKeyboardViewController alloc]initWithNibName:@"MyCustomKeyboardViewController bundle:nil];

    myTextView.inputView = kbvc.view;

    [kbvc release];

Just make sure all components in your custom keyboard xib have the background colour set to ClearColor. Hope that helps!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号