Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/103.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios UIScrollView。如果contentOffset太大,就会出现奇怪的分页行为_Ios_Objective C_Uiscrollview_Scroll Paging - Fatal编程技术网

Ios UIScrollView。如果contentOffset太大,就会出现奇怪的分页行为

Ios UIScrollView。如果contentOffset太大,就会出现奇怪的分页行为,ios,objective-c,uiscrollview,scroll-paging,Ios,Objective C,Uiscrollview,Scroll Paging,Apple对UIScrollView的分页在contentOffset.y大约10000000处有延迟,如果我们在contentOffset.y大约18900000处进行部分滑动,则不会返回原始状态。您可以使用代码mainView检查创建简单应用程序: @implementation MainView - (id) init { self = [super init]; if (self) { self.frame = [UIScreen mainSc

Apple对
UIScrollView
的分页在
contentOffset.y
大约10000000处有延迟,如果我们在
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
@实现主视图
-(id)init
{
self=[super init];
如果(自我)
{
self.frame=[UIScreen mainScreen].bounds;
UIScrollView*滚动=[UIScrollView新建];
scroll.frame=self.frame;
scroll.contentSize=(CGSize){CGRectGetWidth(self.bounds),20000000.0};
scroll.contentOffset=(CGPoint){0.018900000.0};
scroll.paginEnabled=是;
scroll.backgroundColor=[UIColor greenColor];
对于(浮动i=0;i<20000000.0;i+=500.0)
{
UIView*行=[UIView新建];
line.backgroundColor=[UIColor redColor];
line.frame=(CGRect){0,i,self.frame.size.width,30.0};
[滚动添加子视图:行];
}
[自添加子视图:滚动];
}
回归自我;
}
@结束

为什么会这样?有什么想法吗?

在向Apple Bug Reporter报告后,它被修复了。在新版本的XCode中,您将看到一切都是正确的