Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1935
Using IGGridView as an image viewer...
posted

So I'm trying to use the IGGridView as a single image viewer, where a person would swipe left or right to go through the images.

So far I've only ever used the gridview with rows and columns and sections, never as a single cell type approach.

I'm running into a number of questions about how a few of the single cell features relate.

1. IGGridViewDelegate  

-(void)gridView:(IGGridView *)gridView pageChanged:(IGCellPath *)path

What sort of actions did infragistics forsee this event being used for?

I assume it's not to build the cell that displays the image.  Wouldn't cell construction and image assigning still occur in the usual place, at -(IGGridViewCell*)gridView:(IGGridView *)gridView cellAt:(IGCellPath *)path

-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-

2. IGGridViewDataSource

-(IGGridViewCell*)gridView:(IGGridView *)gridView cellAt:(IGCellPath *)path

I assume this method is where you'd construct, configure, and return an IGGridViewImageCell, with the image obtained from some datasource of images I'd maintain, and I'd grab the correct image according to the IGCellPath ??


-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-

3. In IGGridViewDataSource  

-(NSInteger)numberOfSectionsInGridView:(IGGridView *)gridView

If implemented, I'd assume this should return 0 ?


-(NSInteger)gridView:(IGGridView *)gridView numberOfRowsInSection:(NSInteger)section

If implemented, I'd assume this should return 1 ?

-(NSInteger)numberOfColumnsInGridView:(IGGridView *)gridView

If implemented, I'd assume this should return the number of images you have in some array ?? 

Or, perhaps I have it reversed, and the columns is 1, while the 'numberOfRowsInSection' above is where you'd say how many images you have to present ??

-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-

4. What is IGGridViewImageColumnDefinition for ??

-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-

There's a sample in your iPad app that features some functionality that's exactly what I want to do, but it includes a lot of extra behaviors I don't need.

What i'd love to achieve is what this sample does with just it's main large photo... simply swipe left or right to move from image to image.

I don't need the associated thumbnails and behavior.

(A) Is there maybe a trimmed down project that would illustrate just that part?

(B) If not, is that project downloadable, so perhaps I could trace through it and see what parts I can safely remove?

Thanks a lot.

Dave.

  • 40030
    Verified Answer
    Offline posted

    Hi Dave, 

    1. pageChanged is just used for reaction. For example, in the imageViewer sample you reference, we use the pageChanged event to highlight the thumbnail, so that you know what active page you're on. 

    2. Correct. Thats the core of the IGGridViewDataSource, and similar to the UITableView's counterpart method. Its where you reuse your cell and "bind" it to you data. 

    3. Sections are a sort of hierarchy or grouping. There alway has to be at least one section. If you return anything less than zero, we just assume 1. 

    4. IGGridVewImageColumnDefintion is for when you use our IGGridViewDatasourceHelper classes. Basically, these data source helper classes, take out a lot of the work. You don't have to create the cells or specify the number of sections or even the number of columns. Instead you just bind your array of data to the DSH and you're up and running. 

    All of our samples ship with the product in our SamplesBrowser project, so that sample is included. 

    For your convenience i created a bare bones implementation that does just the imageViewer part. You'll notice there isn't much code, b/c i'm using one of our DataSourceHelper classes to connect the data. 

    Let me know if you have any questions!

    -SteveZ

    ImageViewer.zip