0

I have to create a custom UIScrollView containing only 5 labels that would endlessly scroll to imitate a custom control. The label at the centre should change its as well as change another label in a view. This all would look like this:

enter image description here

Any ideas of any framework or implementation of this sort of thing? Thanks in advance!

Sergey Grischyov
  • 11,995
  • 20
  • 81
  • 120
  • Here is some sample code that does what you want :-) http://stackoverflow.com/questions/1383849/loop-an-uiscrollview – arun.s Jan 24 '13 at 11:36

2 Answers2

2

First here best Source Code

It could be that whatever is setting those numbers in there, is not greatly impressed by you setting the contentOffset under its hands. So it just goes on setting what it thinks should be the contentOffset for the next instant - without verifying if the contentOffset has changed in the meantime.

I would subclass UIScrollView and put the magic in the setContentOffset method. In my experience all content-offset changing passes through that method, even the content-offset changing induced by the internal scrolling. Just do [super setContentOffset:..] at some point to pass the message on to the real UIScrollView.

Maybe if you put your shifting action in there it will work better. You could at least detect the 3000-off setting of contentOffset, and fix it before passing the message on. If you would also override the contentOffset method, you could try and see if you can make a virtual infinite content size, and reduce that to real proportions "under the hood".

This is also helpful for you..!!!

iPatel
  • 46,010
  • 16
  • 115
  • 137
1

I implemented something similar to this and the trick is to only load what you need to. This question helped me a lot, especially akosma's answer.

Community
  • 1
  • 1
JDx
  • 2,615
  • 3
  • 22
  • 33
  • The thing there is, with his implementation, I'm not getting it to be 'looping', that's the case. I've updated the name of the question to be more precise. Anyway, thank you for your answer. – Sergey Grischyov Jan 24 '13 at 11:43