1

inputAccessoryView聊天应用程序有一个要求。

当我添加inputAccessoryViewUITextField. UIButton该视图已inputAccessoryView完全设置,但文本字段未成为第一响应者。

(注:超级视图textfield是viewText。)

- (IBAction)btnOpenTextField:(id)sender
{
    UIView *accessoryView=[[UIView alloc]init];
    accessoryView.frame=CGRectMake(0,0, _viewText.frame.size.width, _viewText.frame.size.height);
    [accessoryView addSubview:_viewText];

    _txtMessage.inputAccessoryView = accessoryView;
    [_txtMessage becomeFirstResponder];
}

提前致谢。

4

2 回答 2

1

你可以打电话[_textMessage reloadInputViews],更换[_text becomeFirstResponder]

于 2015-09-14T06:53:26.750 回答
0

What you want to achieve is quite not possible, this will cause recursion, alternatively what you can do is put a textfield on bottom of the screen and when the textfield is selected you can animate it up with the flow of the keyboard. 如果我正确地回答了您的问题,我认为这是一个合适的解决方案。

于 2015-07-06T07:20:22.973 回答