问题
I use UISearchController
to search inline with keyboard, textfield and results in one screen. Does tvOS
allow to customize keyboard? I want to use dark design, but I don't know how to customize the keyboard.
For example YouTube app did that. They have black screen with white keyboard
回答1:
A UISearchController
has a UISearchBar
, which conforms to UITextInputTraits
. This means it has a keyboardAppearance
which you can set to UIKeyboardAppearanceDark
to get a dark keyboard appearance. This isn't identical to what happens in the YouTube app, but it's probably the closest you can get.
回答2:
From the Apple TvOS docs here: https://developer.apple.com/library/prerelease/tvos/documentation/General/Conceptual/AppleTV_PG/CreatingaGreatTextInputExperience.html
"Use UIAlertController or UITextField to customize the keyboard experience and create keyboards specific to your app; for example, an email-specific keyboard or a numeric keyboard. Both UIAlertController and UITextField support all of the available options in UIKit/UITextInputTrailts.h. The inputAccessoryView and inputAccessoryViewController APIs also allow you to customize the keyboard experience."
It seems you can create custom keyboards but maybe not if you're using UISearchController. This document implies that you have to use UITextField in order to customize the keyboard. So it would be a little bit more work but if you don't like the default experience of the UISearchController it shouldn't be that hard to wire up a TableView with a textfield in order to change the user experience.
回答3:
I don't think tvOS allows customizing keyboards yet, because in Application Extension section of tvOS there is no Custom Keyboard thing the way there is for iOS.
来源:https://stackoverflow.com/questions/33776421/customize-keyboard-in-tvos