-1

我添加UITextViewUIToolBar. 当我完成我的UITextView, 和键盘被隐藏,但文字也保留了我的看法。

当我开始我UITextView的照片链接时:

在此处输入图像描述

当我完成我UITextView的照片链接时:

在此处输入图像描述

4

2 回答 2

0

当键盘可见时,您必须对视图进行动画处理。像 :

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1];
CGRect rect=self.view.frame;
rect.origin.y=rect.origin.y-100;
self.view.frame=rect;
[UIView commitAnimations];

您可以根据您的要求调整该 100 值。然后当钥匙消失时做相反的过程。

于 2013-06-28T06:00:32.723 回答
0
- (void)keyboardWasShown:(NSNotification*)aNotification
{
    NSDictionary* info = [aNotification userInfo];
    CGSize kbSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;

    [UIView animateWithDuration:0.2f animations:^{

        CGRect frame = textInputView.frame;
        frame.origin.y -= kbSize.height;
        textInputView.frame = frame;

        frame = bubbleTable.frame;
        frame.size.height -= kbSize.height;
        bubbleTable.frame = frame;
    }];
}

- (void)keyboardWillBeHidden:(NSNotification*)aNotification
{
    NSDictionary* info = [aNotification userInfo];
    CGSize kbSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;

    [UIView animateWithDuration:0.2f animations:^{

        CGRect frame = textInputView.frame;
        frame.origin.y += kbSize.height;
        textInputView.frame = frame;

        frame = bubbleTable.frame;
        frame.size.height += kbSize.height;
        bubbleTable.frame = frame;
    }];
}
于 2013-06-28T06:19:58.783 回答