键盘通知未在设备上触发

Dan*_*nor 0 ipad ios ios6

在模拟器上运行时没有问题,但通知未在设备上发布(iPad 3和Mini都运行iOS 6).如果我自己发布通知,则会调用处理程序.我想知道你们中是否有人碰到这个并且有任何想法.

以下是设置处理程序的代码:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(iPadEditSetTitleHandleKeyboardDidShowNotification:) name:UIKeyboardDidShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(iPadEditSetTitleHandleKeyboardWillShowNotification:) name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(iPadEditSetTitleHandleKeyboardWillHideNotification:) name:UIKeyboardWillHideNotification object:nil];
Run Code Online (Sandbox Code Playgroud)

以及处理程序本身的定义:

- (void)iPadEditSetTitleHandleKeyboardWillHideNotification:(NSNotification *)notification
- (void)iPadEditSetTitleHandleKeyboardWillShowNotification:(NSNotification *)notification
- (void)iPadEditSetTitleHandleKeyboardDidShowNotification:(NSNotification *)notification
Run Code Online (Sandbox Code Playgroud)

任何帮助表示赞赏.

更新:

开始一个新的项目,让这里的所有东西都是视图控制器,所有这一切.

//
//  DWViewController.m
//  KeyboatdTest
//
//  Created by Dan Wesnor on 12/3/12.
//  Copyright (c) 2012 Dan Wesnor. All rights reserved.
//

#import "DWViewController.h"

@interface DWViewController ()

@end

@implementation DWViewController


- (void)handleKeyboardNotification:(NSNotification *)notification
{
    NSLog(@"%@", notification.name);
}



- (void)viewDidLoad
{
    [super viewDidLoad];

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleKeyboardNotification:) name:UIKeyboardWillShowNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleKeyboardNotification:) name:UIKeyboardWillHideNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleKeyboardNotification:) name:UIKeyboardDidShowNotification object:nil];
}



- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
Run Code Online (Sandbox Code Playgroud)

故事板包含单个文本字段.其他一切都是标准的单视图应用模板.

仍然没有快乐.在模拟器中应该工作,但不能在iPad本身上工作.它可能与配置或代码本身之外的某些事情有关吗?

Dan*_*nor 5

这是一个很好的无证件行为.

分割键盘时不会触发这3个通知.但是,看起来在它们通常会触发之前附加UITextField.inputAccessoryView,即使键盘被分割,它们也会触发.因此,在收到UIKeyboardWillChangeFrameNotification后附加附件视图,其他三个将正常激活.