0
내 코드에서 키보드가 튀어 나올 때마다 tableView가 위로 올라가서 tableView의 맨 아래를 볼 수 있습니다. 그러나 상위 3 ~ 4 셀은보기 뒤에 숨어있을 것입니다. 키보드가 떨어지면 scrollView 맨이 잘리는 것 같습니다.ios keyBoardShow with UITableView
문자 메시지를 보낼 때 테이블 뷰를 어떻게 닫을 수 있습니까?
다음내 코드는 ... 셀에 텍스트를 추가 한 후 하단에
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardShow:) name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardHide:) name:UIKeyboardWillHideNotification object:nil];
}
-(void)keyboardShow:(NSNotification *)note{
CGRect keyBoardRect=[note.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
CGFloat deltaY=keyBoardRect.size.height;
[UIView animateWithDuration:[note.userInfo[UIKeyboardAnimationDurationUserInfoKey] floatValue] animations:^{
self.view.transform=CGAffineTransformMakeTranslation(0, -deltaY);
}];
}
-(void)keyboardHide:(NSNotification *)note{
[UIView animateWithDuration:[note.userInfo[UIKeyboardAnimationDurationUserInfoKey] floatValue] animations:^{
self.view.transform = CGAffineTransformIdentity;
}];
}
스크롤.
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:(self.data.count-1) inSection:0];
[self.tableView beginUpdates];
[self.tableView insertRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationRight];
[self.tableView endUpdates];
[self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES];
예, 당신 말이 맞아. 대신 "CGRectMake"를 사용하는 것이 좋습니다. 작품 : 고마워요! – Jenny