Textfield自动更正问题

时间:2012-07-02 12:00:02

标签: iphone

我面临着一个与UITextField的Autocorrection相关的奇怪和奇怪的问题。 我有一个派生自UIScrollView(来自UIScrollView的子类)的类,包含一些textfield,textview&分别位于底部的按钮。

我在textfield&中输入一些文字时遇到问题自动修正泡沫弹出。如果我点击气泡来辞职&点击提供弹出窗口的按钮,它的尺寸正确。但是,如果我不禁用气泡并向上滚动视图以点击按钮,它会弹出错误的位置。

这就是我为呈现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];
}

提前致谢。 塔伦

1 个答案:

答案 0 :(得分:0)

最后,我得到了修复,我发现内容偏移量包含y轴的-ve值。所以简单地做一个检查来比较它是否小于零而且全部是.. :)