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

ios – UIScrollView:contentOffset和bounds.origin有什么区别?,第1张

概述我已经实现了一个UIScrollView委托: - (void) scrollViewDidScroll: (UIScrollView *) scrollView { CGRect bounds = scrollView.bounds ; CGPoint scrollLoc = scrollView.contentOffset ; NSLog(@"bounds: %@ 我已经实现了一个UIScrollVIEw委托:

- (voID) scrollVIEwDIDScroll: (UIScrollVIEw *) scrollVIEw {    CGRect bounds = scrollVIEw.bounds ;     CGPoint scrollLoc = scrollVIEw.contentOffset ;    NSLog(@"bounds: %@ offset:%@",NsstringFromCGRect(bounds),NsstringFromCGPoint(scrollLoc)) ;}

无论我做什么,滚动或旋转设备,似乎contentOffset和bounds.origin始终是相同的.

为什么我们需要一个contentOffset,如果它与bounds origin相同,或者两者实际上是不同的情况是什么?

解决方法 根据 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有什么区别?全部内容,希望文章能够帮你解决ios – UIScrollView:contentOffset和bounds.origin有什么区别?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1078198.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-27
下一篇2022-05-27

发表评论

登录后才能评论

评论列表(0条)

    保存