UIScrollView
Apple的分页contentOffset.y
大约延迟了1000万,如果要在contentOffset.y
18900000左右进行部分滑动,则不要回到原始状态。您可以使用以下代码检查它创建的简单应用程序mainView
:
@implementation MainView
- (id) init
{
self = [super init];
if (self)
{
self.frame = [UIScreen mainScreen].bounds;
UIScrollView *scroll = [UIScrollView new];
scroll.frame = self.frame;
scroll.contentSize = (CGSize){ CGRectGetWidth(self.bounds), 20000000.0 };
scroll.contentOffset = (CGPoint){ 0.0, 18900000.0 };
scroll.pagingEnabled = YES;
scroll.backgroundColor = [UIColor greenColor];
for (float i = 0; i < 20000000.0; i += 500.0)
{
UIView *line = [UIView new];
line.backgroundColor = [UIColor redColor];
line.frame = (CGRect){ 0, i, self.frame.size.width, 30.0 };
[scroll addSubview:line];
}
[self addSubview:scroll];
}
return self;
}
@end
为什么会发生?有任何想法吗?
向Apple Bug Reporter报告后已修复。在新版本的XCode中,您会看到一切正确。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句