-(Void) viewDidLoad {
[[Nsnotificationcenterdefacenter] addObserver: self selector: @ selector (keyboardDidShow :)
Name: UIKeyboardDidShowNotification object: nil];
[[Nsnotificationcenterdefacenter] addObserver: self selector: @ selector (keyboardDidHide :)
Name: UIKeyboardDidHideNotification object: nil];
}
-(Void) keyboardDidShow :( NSNotification *) nsNotification {
NSDictionary * userInfo = [nsNotificationuserInfo];
_ KeyboardSize = [[userInfo objectForKey: UIKeyboardFrameBeginUserInfoKey] CGRectValue]. size;
[SelfupdateTextViewSize];
}
-(Void) keyboardDidHide :( NSNotification *) nsNotification {
_ KeyboardSize = CGSizeMake (0.0, 0.0 );
[SelfupdateTextViewSize];
}
-(Void) updateTextViewSize {
UIInterfaceOrientation orientation =
[UIApplicationsharedApplication]. statusBarOrientation;
CGFloat keyboardHeight = UIInterfaceOrientationIsLandscape (orientation )? _ KeyboardSize. width
: _ KeyboardSize. height;
_ TextView. frame = CGRectMake (0, 0, self. view. frame. size. width, self. view. frame. size. height-keyboardHeight );
}