标签: keyboard

如何检测软件键盘在Android设备上是否可见?

Android中是否有办法检测屏幕上是否显示软件(又称"软")键盘?

keyboard android

221
推荐指数
15
解决办法
24万
查看次数

当键盘快速显示时移动文本字段

我正在使用Swift进行iOS编程,我正在使用此代码移动UITextField,但它不起作用.我keyboardWillShow正确调用该函数,但文本字段不移动.我正在使用autolayout.

override func viewDidLoad() {
    super.viewDidLoad()
    NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("keyboardWillShow:"), name:UIKeyboardWillShowNotification, object: nil);
    NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("keyboardWillHide:"), name:UIKeyboardWillHideNotification, object: nil);
}

deinit {
    NSNotificationCenter.defaultCenter().removeObserver(self);
}

func keyboardWillShow(notification: NSNotification) {
    if let keyboardSize = (notification.userInfo?[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.CGRectValue() {
        //let contentInsets = UIEdgeInsets(top: 0, left: 0, bottom: keyboardSize.height, right: 0)

        var frame = self.ChatField.frame
        frame.origin.y = frame.origin.y - keyboardSize.height + 167
        self.chatField.frame = frame
        println("asdasd")
    }
}
Run Code Online (Sandbox Code Playgroud)

keyboard cocoa-touch uitextfield ios swift

205
推荐指数
14
解决办法
19万
查看次数

UITextField初始键盘动画的超级慢延迟/延迟

好吧,这个问题让我疯了.

触摸后,键盘弹出约需3-4秒UITextField.这仅在应用程序启动后第一次弹出键盘时发生,之后动画立即启动.

起初我认为这是装载太多图像的问题,或者是我的UITableView,但我刚刚创建了一个只有a的全新项目UITextField,我仍然遇到这个问题.我正在使用iOS 5,Xcode ver 4.2,并在iPhone 4S上运行.

这是我的代码:

#import "ViewController.h"

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(20, 20, 280, 30)];
    textField.borderStyle = UITextBorderStyleRoundedRect;
    textField.delegate = self;
    [self.view addSubview:textField];
}

@end
Run Code Online (Sandbox Code Playgroud)

这是所有应用程序的常见问题吗?

现在,我可以做得更好的唯一方法是textField成为/辞职第一响应者viewDidAppear,但这并不能完全解决问题 - 它只是在视图加载时加载延迟.如果我textField在视图加载时立即点击,我仍然会遇到问题; 如果我在视图加载后等待3-4秒才触摸textField,我不会得到延迟.

keyboard cocoa-touch objective-c uitextfield ios

169
推荐指数
6
解决办法
4万
查看次数

电话:用于文本输入的数字键盘

有没有办法强制数字键盘出现在手机上<input type="text">?我刚刚意识到<input type="number">在HTML5中是针对"浮点数",因此它不适用于信用卡号,邮政编码等.

我想模拟数字键盘功能<input type="number">,对于采用浮点数以外的数值的输入.也许还有另一种合适的input类型吗?

keyboard android numbers html-input ios

164
推荐指数
8
解决办法
21万
查看次数

如何在android中的EditText上显示数字键盘?

我只是想在某个EditText具有焦点时立即切换到数字键盘模式.

keyboard android android-edittext

142
推荐指数
7
解决办法
16万
查看次数

仅在键盘覆盖输入字段时才向上移动视图

我正在尝试为iPhone构建输入屏幕.屏幕有许多输入字段.其中大多数位于屏幕顶部,但两个字段位于底部.当用户尝试编辑屏幕底部的文本时,键盘将弹出并覆盖屏幕.我找到了一个简单的解决方案,可以在发生这种情况时将屏幕向上移动,但结果是屏幕总是向上移动,当用户尝试编辑屏幕时,屏幕顶部的字段会移动.

有没有办法让屏幕在编辑底部字段时移动?

我使用了这里找到的代码:

override func viewDidLoad() {
    super.viewDidLoad()        
    NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("keyboardWillShow:"), name: UIKeyboardWillShowNotification, object: nil)
    NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("keyboardWillHide:"), name: UIKeyboardWillHideNotification, object: nil)
}

func keyboardWillShow(sender: NSNotification) {
    self.view.frame.origin.y -= 150
}

func keyboardWillHide(sender: NSNotification) {
    self.view.frame.origin.y += 150
}
Run Code Online (Sandbox Code Playgroud)

keyboard ios swift xcode6

140
推荐指数
5
解决办法
15万
查看次数

如何检测WPF中的修饰键状态?

当我需要访问Control,Shift,Alt按钮是否关闭时,是否有一些全局构造可以使用?例如MouseDown,一个内部事件TreeView.

如果是这样的话?

.net c# keyboard wpf

137
推荐指数
5
解决办法
8万
查看次数

Xcode iOS 8不支持键盘类型

我在课堂上UITextField按Ctrl键拖动.现在,我正在使用此代码@Outlet.swiftviewDidLoad

self.myTextField.keyboardType = UIKeyboardType.DecimalPad
Run Code Online (Sandbox Code Playgroud)

当我在模拟器上启动我的应用程序并单击UITextField我得到此日志

    Can't find keyplane that supports type 8 for keyboard 
    iPhone-Portrait-DecimalPad; 
    using 2617181025_Portrait_iPhone-Simple-Pad_Default
Run Code Online (Sandbox Code Playgroud)

我没有崩溃或什么,但没有显示键盘.我也尝试设置它,Storyboard但它是一样的.

我也注意到,每当我点击任何 UITextField键盘时都不会显示(但是没有显示默认键盘的日志)

我正在使用Xcode-Beta 3任何人遇到这个问题?

keyboard xcode ios swift ios8

125
推荐指数
5
解决办法
10万
查看次数

滚动UITableView时隐藏键盘

在我的应用程序中,当我开始滚动UITableView时,我想隐藏键盘.我在互联网上搜索这个,大多数答案是子类化UITableView(http://stackoverflow.com/questions/3499810/tapping-a-uiscrollview-to-hide-the-keyboard).

我做了子类但它不起作用.

#import <UIKit/UIKit.h>

@protocol MyUITableViewDelegate <NSObject>
@optional
- (void)myUITableViewTouchesBegan;
@end

@interface MyUITableView : UITableView <UITableViewDelegate, UIScrollViewDelegate> {
    id<MyUITableViewDelegate> delegate;
}
@end
Run Code Online (Sandbox Code Playgroud)

.m文件

#import "MyUITableView.h"

@implementation MyUITableView

- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
    NSLog(@"delegate scrollView"); //this is dont'work
    [super scrollViewDidScroll:scrollView];
}

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    NSLog(@"delegate myUITableViewTouchesBegan"); // work only here
    [delegate myUITableViewTouchesBegan];
    [super touchesBegan:touches withEvent:event];

}

- (void)dealloc {
...
Run Code Online (Sandbox Code Playgroud)

我像这样使用这个类.但委托函数myUITableViewTouchesBegan在ViewController中不起作用

.H

#import <UIKit/UIKit.h>
#import "MyUITableView.h"

@interface FirstViewController : UIViewController <UITableViewDelegate, UISearchBarDelegate, MyUITableViewDelegate> {
    MyUITableView *myTableView;
    UISearchBar *searchBar; 
}

@property(nonatomic,retain) …
Run Code Online (Sandbox Code Playgroud)

keyboard scroll uitableview ios

124
推荐指数
5
解决办法
6万
查看次数

iPhone键盘覆盖UITextField

我有一个应用程序,在Interface Builder中,我设置了一个UIView在视图底部附近有文本字段的应用程序.当我运行应用程序并尝试在该字段中输入文本时,键盘会向上滑动到字段上方,所以在我再次隐藏键盘之前,我无法看到我正在键入的内容.

有没有其他人遇到这个问题并找到一个很好的方法来解决它,既没有使父视图可滚动或移动文本字段更远的屏幕?

iphone keyboard uitextfield ios

121
推荐指数
8
解决办法
9万
查看次数