1
我有一個方法,當鍵盤顯示時被調用。它正在研究其他觀點。不知怎的,TableView會被移動。
-(void) keyboardDidShow:(NSNotification *) notification {
// -- return if keyboard is still shown
MyManager *sharedManager = [MyManager sharedManager];
if ([sharedManager.keyboardIsShown isEqualToString:@"YES"]) return;
NSDictionary* info = [notification userInfo];
//---obtain the size of the keyboard---
NSValue *aValue = [info objectForKey:UIKeyboardFrameEndUserInfoKey];
CGRect keyboardRect = [self.view convertRect:[aValue CGRectValue] fromView:nil];
//---resize the scroll view (with keyboard)---
CGRect viewFrame = [scrollView frame];
viewFrame.size.height -= keyboardRect.size.height;
scrollView.frame = viewFrame;
//---scroll to the current text field---
CGRect textFieldRect = [currentTextField frame];
[scrollView scrollRectToVisible:textFieldRect animated:YES];
sharedManager.keyboardIsShown = @"YES";
}
您如何看待它? – Legolas
你如何佈置你的觀點? – BoltClock
你可以發佈你的'autoresizingmask'爲tableview嗎? –