ShinobiDataGrid scroll delegate [iOS]


#1

Hi,

I’m displaying 4 different ShinobiDataGrids in the same view controller. For one of them I need to do some action when it ends scrolling. Since SDataGridDelegate conforms to UIScrollViewDelegate, I implemented the scrollViewDidEndScrolling: delegate method.

When I scroll the grid, the method gets called; the problem is that the scrollView object is an instance of ShinobiGrid and not ShinobiDataGrid (and of course is a different object from my grid), so:

  • (void)scrollViewDidScroll:(UIScrollView *)scrollView {
        if (scrollView == myGrid) {
    // it never goes in here!
        }
    }

What did I do wrong?

Thanks,
Alberto


#2

Hi Alberto,

The ShinobiDataGrid is a wrapper for our ShinobiGrid class, offering a more user friendly API. Hence this is why you are getting a ShinobiGrid passed in to the delegate method.

I would recommend accessing the DataGrid you wish to edit directly via the property you store it in rather than using the scrollview parameter.

Let me know if you have any questions.

Kind regards,
Andrew Polkinghorn.


#3

Hi Andrew,

thanks for answering, but I don’t understand how it solves my problem.

I need to know when a grid has scrolled, that’s why I implemented the scrollViewDidScroll: delegate method.
Is there another way to achieve this? Or alternatively: is there a way to get the ShinobiDataGrid object from the ShinobiGrid?

Thanks again,
Alberto


#4

Hi Alberto,

I think the best solution here is to do something like, “if([scrollview isDescendantOfView:dataGrid]){ … }” for each of your potential datagrids, in order to detect which datagrid has been scrolled upon.

Hope this helps!