我有一个具有三个级别的 UIViewControllers 的向下钻取导航应用程序。在每个视图控制器中,我都有一个 UITextField,我试图将 UIKeyboard 子类化为每个视图控制器。我的问题是在哪里“设置”通知和“取消设置”它们。
我有通知:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
所以最好在 viewDidLoad 事件中设置它们?还是 viewWillAppear 事件?
同样对于[[NSNotificationCenter defaultCenter] removeObserver:self];
我不想在keyboardWillShow:
向下钻取时调用多个事件。
非常感谢,布雷特