- (void)keyboardDidShow:(NSNotification *)note { // something } - (void)keyboardDidHide:(NSNotification *)note { // something } - (id)init { self = [super init]; if (self) { // キーボードが表示された時 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidShow:) name:UIKeyboardDidShowNotification object:nil]; // キーボードが隠れた時 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidHide:) name:UIKeyboardDidHideNotification object:nil]; } return self; }
↧
iOSでキーボードの表示と非表示に応じた処理をする
↧