게시 된 코드는 필요한 부분의 일부만 존재하기 때문에 잘못하고있는 것을 디버깅하기에는 상당히 불완전합니다. 이것이 당신이 찾고있는 해결책인지 확인해주십시오. 당신의 init
방법에서
는 다음과 같은 추가
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
이 구현이 추가 (또는 헤더 파일에 추가) :
- (void)keyboardWillShow:(NSNotification *)notification {
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
#endif
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_3_2
NSValue *keyboardBoundsValue = [[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey];
#else
NSValue *keyboardBoundsValue = [[notification userInfo] objectForKey:UIKeyboardBoundsUserInfoKey];
#endif
CGRect keyboardBounds;
[keyboardBoundsValue getValue:&keyboardBounds];
UIEdgeInsets e = UIEdgeInsetsMake(0, 0, keyboardBounds.size.height, 0);
[[self tableView] setScrollIndicatorInsets:e];
[[self tableView] setContentInset:e];
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2
}
#endif
}
그리고이 마지막으로 당신의 dealloc
방법, 추가
를
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil];
이 코드는 ASIAuthenticati에서 가져 왔습니다. 벤 copsey의 ASIHTTPRequest 랩퍼의 onDialog 클래스. 희망이 도움이됩니다.