i am trying add an additionalButton in inputToolbar of the JSQMessageViewController , but the problem is whenever inputToolbar resign or become firstResponder the frames of inputToolbar's contentView
reFrames itself and additionalButton appears over the textview. can anyone help me what do in this situation by which the additionalButton and inputToolbar's textview not overlaps each other.
this is the following code:
@viewDidAppear
CGRect leftBtnFrame = self.inputToolbar.contentView.leftBarButtonContainerView.frame;
btnRabbit = [[UIButton alloc]initWithFrame:CGRectMake(leftBtnFrame.origin.x + leftBtnFrame.size.width +5 , leftBtnFrame.origin.y, leftBtnFrame.size.width, leftBtnFrame.size.height)];
[btnRabbit addTarget:self action:@selector(btnRabbitPressed) forControlEvents:UIControlEventTouchUpInside];
[btnRabbit setImage:[UIImage imageNamed:@"donkey_icon"] forState:UIControlStateNormal];
textViewFrame = self.inputToolbar.contentView.textView.frame;
textViewFrame.origin.x = textViewFrame.origin.x +btnRabbit.frame.origin.x - self.inputToolbar.contentView.leftContentPadding;
textViewFrame.origin.y = textViewFrame.origin.y;
textViewFrame.size.height = textViewFrame.size.height;
textViewFrame.size.width = textViewFrame.size.width - btnRabbit.frame.origin.x;
[self setToolBar];
@setToolBar
[UIView animateWithDuration:0.2 animations:^{
[self.inputToolbar.contentView addSubview:btnRabbit];
} completion:^(BOOL finished) {
[self.inputToolbar.contentView.textView setFrame:textViewFrame];
}];
and i am calling setToolBar in the following keyboard notification observer delegate
-(void)keyboardWillShow:(NSNotification *)notification {
[self setToolBar ];
}