The UITextView is becoming focused by default in iOS and brings up the keyboard for user input. This is not the case in tvOS. UITextView in tvOS is not becoming focused by default and if manually setting it to focused it will still not bring up the keyboard screen. The UITextField is however becoming focused in both iOS and tvOS and requires basically the same implementation. So the UITextView is replaced with UITextField to bring up keyboard in both iOS and tvOS. The UIToolbar class is not supported in tvOS. Instead implement the toolbar as a UITabBar. The UITabBar is set directly as the inputAccessoryView to the keyboard view in tvOS while in iOS it's put in a UIScrollView (as the previous UIToolbar) to be able to scale the inputAccessoryView better for small screens. The UITabBar behaves a little bit different on iOS and tvOS where in tvOS the delegate function -(void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item is called when navigated to a specific toolbar item, while in iOS called when clicking on an item. To get the tvOS to trigger action on presses, add a gesture recognizer to handle touch events. Since the keyboard view on Apple TV always full screen prompted texts gets hidden behind the keyboard. Delay the showing of the keyboard to allow the user to understand what's requested as input.
48 lines
1.4 KiB
Objective-C
48 lines
1.4 KiB
Objective-C
/* ScummVM - Graphic Adventure Engine
|
|
*
|
|
* ScummVM is the legal property of its developers, whose names
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
* file distributed with this source distribution.
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
*/
|
|
|
|
#ifndef BACKENDS_PLATFORM_IOS7_IOS7_KEYBOARD_H
|
|
#define BACKENDS_PLATFORM_IOS7_IOS7_KEYBOARD_H
|
|
|
|
#include <UIKit/UIKit.h>
|
|
#include <UIKit/UITextView.h>
|
|
|
|
@class TextInputHandler;
|
|
|
|
@interface SoftKeyboard : UIView<UITextFieldDelegate> {
|
|
id inputDelegate;
|
|
TextInputHandler *inputView;
|
|
}
|
|
|
|
- (id)initWithFrame:(CGRect)frame;
|
|
- (void)dealloc;
|
|
- (UITextField *)inputView;
|
|
- (void)setInputDelegate:(id)delegate;
|
|
- (void)handleKeyPress:(unichar)c;
|
|
- (void)handleMainMenuKey;
|
|
|
|
- (void)prepareKeyboard:(NSNotification *)notification;
|
|
- (void)showKeyboard;
|
|
- (void)hideKeyboard;
|
|
|
|
@end
|
|
|
|
#endif
|