【问题标题】:Why can't I scroll in iOS 7.0 in UIScrollView?为什么我不能在 iOS 7.0 中的 UIScrollView 中滚动?
【发布时间】:2013-10-08 08:36:35
【问题描述】:

关于iOS 6.1及更低版本UIScrollViewdelayContentTouches选项的设置,

  1. 如果设置为YES:滚动功能正常,触摸事件稍晚发生。
  2. 如果设置为NO:滚动功能不起作用,触摸事件立即发生

但在 iOS 7.0 中,无论设置delayContentTouches 的选项(YESNO), 滚动功能效果不佳,但触摸事件发生了。


下载示例代码

http://goo.gl/cSg1bE

【问题讨论】:

    标签: ios xcode uiscrollview scroll ios7


    【解决方案1】:

    在您的 viewDidLoad() 方法中使用此代码。

    滚动使用这个

    NSIndexPath *indexPath = [NSIndexPath indexPathForRow:1 inSection:0];
    [tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:YES];
    
    
    scrollToRowAtIndexPath: 
    

    仍然适用于 ios 7。

    float systemVersion= [[[UIDevice currentDevice] systemVersion] floatValue];
    
    if(systemVersion >= 7.0f)
    {
      self.edgesForExtendedLayout=UIRectEdgeNone;   
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-30
      • 2014-08-26
      • 2014-05-05
      • 2013-06-12
      • 2013-10-30
      相关资源
      最近更新 更多