How to check UIButton position in a ScrollView?
I have a UIButton in a ScrollView. This button is hided by the NavigationBar, so it is visible only when the user drag down the ScrollView. I want to check the position of the UIBut开发者_如何学Cton, and if the y position is <= 41 then i want to display an Alert How can I make this? Thanks!! Bye
The position of the yButton never changes (As in the frame of the yButton is the same in the scroll view). What does change is the contentOffset
property of the UIScrollView
. So you can implement the delegate method – scrollViewDidScroll:
which can implement the logic to determine if the button is in your desired state.
精彩评论