- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我已经实现了一个 UIScrollView 委托(delegate):
- (void) scrollViewDidScroll: (UIScrollView *) scrollView {
CGRect bounds = scrollView.bounds ;
CGPoint scrollLoc = scrollView.contentOffset ;
NSLog(@"bounds: %@ offset:%@"
, NSStringFromCGRect(bounds)
, NSStringFromCGPoint(scrollLoc)) ;
}
无论我做什么,滚动或旋转设备,contentOffset
和 bounds.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/
我正在尝试了解 Azure 认知搜索中的技能组。我想构建一个 Ocr 支持的搜索,并尝试了解它是如何工作的。 例如documentation说 ocr 技能 产生响应: { "text": "He
我正在为 tvOS 开发一个小型应用程序,我需要在其中显示 UITextView。 不幸的是,有时此文本无法容纳在屏幕内,这就是为什么我需要一种以编程方式滚动到其底部的方法。 我尝试使用以下代码: s
所以我有以下代码: int actualPosition = self.collectionView.contentOffset.y; NSLog(@"%i", actualPosition); 输出
我制作了一个带有几个按钮的 .xib 文件,并将其附加到 inputAccessoryView。我使用scrollView使该部分可滚动,但是我必须使用按钮(箭头)添加附加功能。单击向前箭头,它应该转
我有一个按钮可以改变 scrollOffset 的颜色。我有下面的代码工作,除了它在相反的方向执行动画。我不希望它从透明变为不透明 (0% - 100%),而是相反 (100% - 0%)。我想我计算
我有一个启用了分页的 UICollectionView,旋转后页面 contentOffset 没有正确调整。 我重写了下面两个方法 override func viewWillTransitionT
我试图在 setContentOffset 动画中间获取 UIScrollView 的 contentOffset 属性。请注意,我没有使用该方法的动画属性,而是将 setContentOffset
这是一个非常简单的问题,真的: 如果我告诉我的UIScrollView设置其contentOffset类似于 {0, 50} ,然后将其设置为 {0, 100}片刻之后,它的最终位置会是y = 100
看到围绕更改 ScrollView 的内容偏移属性的奇怪问题。 我有一个CADisplayLink,它每帧调用一个方法。该方法计算调整内容偏移量以产生自动滚动类型的效果。 @objc private
我有一个 UIScrollView,只要点击 View ,它就会重置其 contentOffset。 这在此处进行了演示:https://gyazo.com/c8fb5c0fa5b6d53acf45c
我有一个带分页的 ScrollView 。我声明: if(_fullPosterScroll == nil) _fullPosterScroll = [[UIScrollView alloc]
当用户拖动它或系统为其滚动设置动画时,我需要从 UIScrollView 获取 x 偏移量。 我正在使用 - (void)scrollViewDidScroll:(UIScrollView *)scr
我正在开发 iPhone 应用程序。我的代码是这样实现的: RootViewController 将 UIScrollView 作为其 View 。然后 RootViewController 推送另一
我正在向我的 UITableView 添加一个 UISearchBar。与许多应用程序一样,搜索栏最初会隐藏在导航栏后面,直到用户向上滚动,才会显示出来。我使用下面的代码最初隐藏搜索栏,当表格 Vie
我有一个 UITableView,我想隐藏它的一部分标题(有点像拉动刷新)。我用 contentOffset 做了它,当内容大于屏幕时它工作正常。它在需要时隐藏并在需要时显示,但是当内容占用的空间小于
我想在用户滚动时更改 View 的框架。我正在检查 scrollViewDidScroll 中 ScrollView 的 contentOffSet,我想知道 contentOffSet 何时达到特定
我在 UIViewController 中有一个 UITableView 作为 subview 。当用户按下 tableView 下的 UITextfield 时,我在键盘出现时设置 tableVie
我有一个大的水平 ScrollView ,上面有不同的 View 。滚动工作正常,但现在我添加了按钮以转到下一页的上一页。我认为这段代码可以解决问题,因为我已经用过几次了: -(void)goBack
我正在使用计时器并打印 UIScrollView 的 contentOffset.y 以一直跟踪它。 但问题是 UIScrollView 仅在减速后更新其 contentOffset 值。 我想知道
我有一个 UIViewController,它有多个从屏幕外进入的 UIView。我没有在 UIViewController 中初始化和设计所有这些 UIView,而是创建了单独的 nib 文件和相应
我是一名优秀的程序员,十分优秀!