【发布时间】:2014-10-12 17:21:11
【问题描述】:
目的:我试图在键盘出现时用“隐藏键盘”UIBarButtonItem 切换“保存”UIBarButtonItem(然后在单击“隐藏键盘”按钮时执行相反的操作)。
到目前为止,我已经创建了两个 UIBarButtonItem 并将它们都连接到 Interface Builder。
@property (weak, nonatomic) IBOutlet UIBarButtonItem *saveButton;
@property (weak, nonatomic) IBOutlet UIBarButtonItem *hideKeyButton;
这是我到目前为止在我的主目录中设置的代码:
- (void)keyboardDidShow:(NSNotification *)aNotification {
// Show HideKey Button
// Hide Save Button
}
- (void)keyboardWillHide:(NSNotification *)aNotification {
// Show Save Button
// Hide HideKey Button
}
在 Interface Builder 上,默认情况下存在“保存”按钮。以编程方式,如何显示 HideKey 按钮和隐藏 Save 按钮?谢谢。
【问题讨论】:
标签: ios uinavigationcontroller uibarbuttonitem keyboard-events