我面临一个与 UITextField 的自动更正相关的奇怪而奇怪的问题。我有一个派生自 UIScrollView 的类(UIScrollView 的子类),分别在底部包含一些文本字段、文本视图和按钮。
当我在文本字段中输入一些文本并弹出自动更正气泡时,我遇到了一个问题。如果我点击气泡使其退出并点击显示弹出框的按钮,它的尺寸正确。但是,如果我不禁用气泡并向上滚动视图以点击按钮,它会弹出错误的位置。
这就是我为呈现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];
}
提前致谢。塔伦