LONGI
LONGI

Reputation: 11443

Objective c: How to get final scroll Position of UITextView on Touch up?

I have an application, where two iPads are connected via Bluetooth LE. One iPad is the sender and the other one is the receiver (user input disabled).

My goal is, if the sender is scrolling in a 'UITextView', I want to send a command to the receiver to scroll his UITextView to the same position.

Question 1: How do I get the Y-Scroll-Position of the sender? (sth like: [myTextView currentScrollPosition] )

I use the (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView to detect the end of scrolling. However, to get a better "synchronized" feeling..

Question 2: Is it possible to listen to the TouchUp Event from the User (that means: User ends scrolling, but UITextView still continues his "lazy scrolling to end") and get the end scroll position at that moment?

Upvotes: 0

Views: 838

Answers (1)

meronix
meronix

Reputation: 6176

question 2:

a fast answer: use

- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate

(same UIScrollViewDelegate Protocol Reference as scrollViewDidEndDecelerating)

question 1:

i'm not sure i got the question point... scrollViewDidEndDecelerating is the right place to get y-scroll position... what else do you need?

Upvotes: 1

Related Questions