2014-12-08 22 views

回答

0

我认为这是可能的按我的看法试试这个它没有设置约束,但你可以调整你的TextView的大小。

在您的viewDidLoad方法写通知

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidShow:) name:UIKeyboardWillShowNotification object:nil]; 
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidHide:) name:UIKeyboardWillHideNotification object:nil]; 

,并设置你的TextView大小时键盘看起来像是为

- (void) keyboardDidShow:(NSNotification *)aNotification 
{ 
    self.textView.frame=CGRectMake(As Your needed size); 
} 

,如果你想在键盘解雇的话,我想我的TextView尺寸

如设置然后你设置新的方法,如

- (void) keyboardDidHide:(NSNotification *)aNotification 
{ 
self.textview.frame=cgrectmake(As your Exact Size); 
} 

并且还写一个辞职第一响应者的方法为您的文本视图,如果你想它像

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 
{ 
[self.textView resignFirstResponder]; 
}