I have a UIPopover
with a UIScrollView
inside it that contains a UITextView
at the bottom. When the keyboard shows, the popover is resized as the text view begins to be edited. I want the code below to ensure the text view is visible:
- (void)textViewDidBeginEditing:(UITextView *)textView {
CGRect visRect = textView.frame;
[self.scrollView scrollRectToVisible:visRect animated:NO];
}
The problem is that the code does not make the entire text view visible. Instead, only the text view up to the bottom of the cursor is shown, as shown below:
How can I show the entire text view/ scroll the scrollview to the bottom? I have tried this:
CGPoint bottomOffset = CGPointMake(0, self.scrollView.contentSize.height - self.scrollView.bounds.size.height);
[self.scrollView setContentOffset:bottomOffset animated:YES];
as explained in this answer but nothing works.
In addition, my scrollview is scrolled to the position shown AFTER the keyboard is moved into place. Ideally I'd like the scrolling to happen before or during the keyboard movement.
Any help would be great.
@hey Dave
This By default Case in of UIPopOverController
, whenever we used UIPopOverControler
to display any PopUpView
and in suppose that PopUpView
height as large as can be covered by KeyBoard
then in that case that PopOverView
Automatically gets Shrink itself.as you resign keyboard that PopUpView will expand itself automatically.I have faced same case.
This is just my opinion , you can change the origin of CurrentView(parentView of PopUpView)
as keyboard going to display/hide so that PopUpView
could display itself properly from and could get the appropriate space.
See Below Are the Delegate methods of UITextView Responds Back as editing start and end.
- (BOOL)textViewShouldBeginEditing:(UITextView *)textView
{
//chnage the OriginY of PopUpView's SUperView
}
- (void)textViewDidBeginEditing:(UITextView *)textView
{
//re Adjust the OriginY of PopUpView's SUperView
}
I hope it may helpful to you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With