【问题标题】:Why can't I scroll in iOS 7.0 in UIScrollView?为什么我不能在 iOS 7.0 中的 UIScrollView 中滚动?
【发布时间】:2013-10-08 08:36:35
【问题描述】:
关于iOS 6.1及更低版本UIScrollView上delayContentTouches选项的设置,
- 如果设置为
YES:滚动功能正常,触摸事件稍晚发生。
- 如果设置为
NO:滚动功能不起作用,触摸事件立即发生
但在 iOS 7.0 中,无论设置delayContentTouches 的选项(YES 或NO),
滚动功能效果不佳,但触摸事件发生了。
下载示例代码
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;
}