0
Apple的UIScrollView
的分頁延遲爲contentOffset.y
大約10000000,如果我們將在contentOffset.y
處進行部分刷卡,則不會以原始狀態返回大約18900000.您可以檢查它使用mainView
的代碼創建簡單的應用程序:UIScrollView。如果contentOffset太大,則會出現Paging的奇怪行爲
@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
爲什麼發生這種情況?有任何想法嗎?