【发布时间】:2015-01-02 10:07:29
【问题描述】:
我想在 UIScrollView 中获取 UIButton 的位置,问题是当 UIButton 为在它的原始位置,或者如果我向下滚动......
我正在使用 NSLog 打印位置并且得到相同的输出
-
没有向下滚动我得到...
2014-11-05 19:28:02.564 ... {{260, 163}, {370, 225}} -
即使我向下滚动,我也会得到相同的输出...
2014-11-05 19:28:06.052 ... {{260, 163}, {370, 225}}
这是我用来获取 UIScrollView 内 UIButton 位置的代码...
NSLog(@"%@", NSStringFromCGRect(CGRectMake(myButton.frame.origin.x, myButton.frame.origin.y, myScrollDown.frame.size.width, myScrollDown.frame.size.height)));
有办法在我向下滚动后获取 UIButton 的实际位置吗?
还有其他方法可以获取 ScrollView 中 UIButton 的位置吗?
我已经访问了以下链接,但我还没有解决它。
get UIButton inside an UIScrollView absolute screen location
iPhone - Get Position of UIView within entire UIWindow
Cocoa: What's the difference between the frame and the bounds?
感谢您的帮助!
【问题讨论】:
标签: ios objective-c xcode uiscrollview uibutton