I am facing a strange and weird problem related with the UITextField’s Autocorrection.
I have a class which is derived from UIScrollView(subclass from UIScrollView), containing some textfield, textview & buttons at the bottom respectively.
I am facing a problem while i input some text in the textfield & autocorrection bubble pops up. If i tap on the bubble to resign it & tap on the button which presents the popover, it comes at correct dimensions. But if i don’t disable the bubble and scroll up the view to tap the button, it pops up with wrong positions.
This is what i’m doing for presenting popover:
- (void)presentImagePicker:(UIImagePickerControllerSourceType)type
withAnimation:(BOOL)animated {
if ([popoverViewController_ isPopoverVisible]) {
[popoverViewController_ dismissPopoverAnimated:YES];
return;
}
UIImagePickerController *picker =
[[[UIImagePickerController alloc] init] autorelease];
[picker setDelegate:self];
[picker setSourceType:type];
[[picker navigationBar] setTintColor:[UIColor bloggerBarColor]];
UIPopoverController *popoverController =
[self popoverWithViewController:picker];
CGRect rect = CGRectZero;
if (type == UIImagePickerControllerSourceTypePhotoLibrary) {
rect = [[composeView_ addPhotoLibraryButton] frame];
} else {
rect = [[composeView_ addPhotoCameraButton] frame];
}
[popoverController presentPopoverFromRect:rect
inView:[self view]
permittedArrowDirections:UIPopoverArrowDirectionAny
animated:YES];
}
Thanks in advance.
Tarun
Finally,I got the fix, I observed that the content offset was containing a -ve value for y-axis. So simply made a check to compare if it is less than zero and that’s all.. 🙂