2011-08-06 13 views
1

TableViewCell gets shifted up when keyboardIsShownなぜ私のTableViewは上に移動しましたか?

キーボードが表示されたときに呼び出されるメソッドがあります。それは他の視点で働いています。何とかTableViewが上に移動します。 myTableView.autoresizingMask = 0;を設定

-(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"; 

}

+0

どのように見えると思いますか? – Legolas

+0

あなたの意見はどのようにレイアウトしていますか? – BoltClock

+1

あなたはあなたの 'autoresizingmask'をtableviewに投稿できますか? –

答えて

4

トリックをしました。

関連する問題