gpt4 book ai didi

ios - UIScrollView:contentOffset 和 bounds.origin 有什么区别?

转载 作者:可可西里 更新时间:2023-11-01 05:10:27 28 4
gpt4 key购买 nike

我已经实现了一个 UIScrollView 委托(delegate):

- (void) scrollViewDidScroll: (UIScrollView *) scrollView {
CGRect bounds = scrollView.bounds ;
CGPoint scrollLoc = scrollView.contentOffset ;

NSLog(@"bounds: %@ offset:%@"
, NSStringFromCGRect(bounds)
, NSStringFromCGPoint(scrollLoc)) ;
}

无论我做什么,滚动或旋转设备,contentOffsetbounds.origin 似乎总是相同的。

如果 contentOffset 与边界原点相同,为什么我们需要一个 contentOffset,或者当两者实际上不同时又会怎样?

最佳答案

根据docs :

The contentOffset property is always the current location of the top-left corner of the scroll bounds, whether scrolling is in progress or not.

关于ios - UIScrollView:contentOffset 和 bounds.origin 有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8625911/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com