2010-04-23 82 views
2

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

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

回答

0

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

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); 
    } 
} 

谢谢

+0

这是一个很大的代码,东西告诉我有一个简单的方法:) – logancautrell 2010-09-14 14:30:44