I have two horizontal scrollbar ,contents of the upper scroll bar are static where as contents of the lower scroll bar are dynamic and depend on the selection of item in the upper scroll bar.
Now selection is not a normal selection with a click, selection occurs when that particular item comes under that pointer above the scroll bars.As the contents of the upper scroll bar are static selection is not a problem beacause I can identify which item is under that pointer with the help of the offset which I can get with help of the scrollview delegate method scrollViewDidEndDecelerating & scrollViewDidEndDragging.
Problem is with the lower scroll bar where contents are dynamic thats why I can not identify which item is under the pointer,is there any way to identify which item is currently under that pointer for the lower scroll bar beacause further porcessing depends on the selection of item in the second scroll bar.
Please help me if any one has an idea about how to do that.
I have two horizontal scrollbar ,contents of the upper scroll bar are static where
Share
I’m not quite sure what you mean when you say “dynamic”. The second lower scrollbar has contents that change often. So when you populate that scrollView, you should use a mutable container to keep track of what is where.
For example, create a NSRange for each horizontal item (ie location is 0, length is 100, location is 100, length is 50), turn that into a NSValue, and store this NSValue as the key and your “object” at that location in a mutable dictionary. When you need to know what’s under the pointer (which is say x=160), you add that value to the lower scrollView contentOffset (which is say 200) and get 260 as the offset in question, then you iterate through your dictionary looking for the item that contains the range 260.