弹出窗口中的UITableView不会停止滚动

时间:2010-04-23 01:33:51

标签: iphone cocoa-touch uitableview ipad

我在弹出窗口中显示了一个UITableView。我的表视图中的一个单元格中有一个UITextField。当正在编辑文本字段(键盘可见)并且我将设备从纵向旋转到横向然后尝试滚动表格视图时,它会不断超出其边界,而不是停止并“弹跳”。

有谁知道如何解决这个问题?

2 个答案:

答案 0 :(得分:0)

您可以尝试检测设备何时旋转,并调用tableViewController方法,该方法将所选单元格的滚动位置调整到您需要的区域。

答案 1 :(得分:0)

旋转设备时可以使用以下代码

     - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
      {

        if ([appDelegate.aPopover isPopoverVisible])
       {
        [appDelegate.aPopover dismissPopoverAnimated:NO];

        CGSize size = [self rotatedSize];
        size.height -= [[self.view viewWithTag:154] frame].size.height;

        appDelegate.aPopover.popoverContentSize = size;

        [appDelegate.aPopover presentPopoverFromRect:[[self.view viewWithTag:154] frame]
                                              inView:self.view
                            permittedArrowDirections:UIPopoverArrowDirectionDown
                                            animated:YES];
    }
}

       // for set popoverview size when rotate screen
         -(CGSize)rotatedSize
         {
         UIDeviceOrientation orientation1 = [[UIDevice currentDevice] orientation];
         UIInterfaceOrientation toInterfaceOrientation =  orientation1;
         if ((toInterfaceOrientation == UIInterfaceOrientationPortrait) || (toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown))
        {
              return self.view.frame.size;
      }
    else
    {
        return CGSizeMake(self.view.frame.size.height, self.view.frame.size.width);
    }
}

谢谢,