【问题标题】:UITableView in popover doesn't stop scrolling弹出窗口中的 UITableView 不会停止滚动
【发布时间】:2010-04-23 01:33:50
【问题描述】:

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

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

【问题讨论】:

    标签: iphone cocoa-touch uitableview ipad


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

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

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

      谢谢,

      【讨论】:

      • 代码很多,告诉我有更简单的方法:)
      猜你喜欢
      • 1970-01-01
      • 2012-08-12
      • 2011-08-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多