Custom UIView instead of image? #184

Open
vburojevic opened this Issue Dec 5, 2012 · 8 comments

3 participants

@vburojevic

Is it possible to load custom UIView in cells?
In my example, thumbnail with controls to download and share image at the bottom of the image.

I've been trying for 2 days but haven't succeeded...

@evadne
Collaborator
@iprebeg

Your custom view must inherit AQGridViewCell, that's all. Be careful, cells are cached and reused so do not rely on keeping any context inside as is will get wiped of by simple scroll on grid view. I'm talking about possible progress views and stuff.

@vburojevic

Ok, I will try, thank you.

Another questions since I posted this one already.
I am trying to set AQGridView to show 2 items in row if iPad and 1 item if iPhone.
And I want these two items (or one) to take 80 width of the screen.

I have overridden:

  • (NSUInteger) numberOfItemsPerRow
    {
    /*
    if ( _layoutDirection == AQGridViewLayoutDirectionVertical )
    return ( (NSUInteger)floorf(_boundsSize.width / _actualCellSize.width) );

    // work out how many rows we can fit
    NSUInteger rows = (NSUInteger)floorf(_boundsSize.height / _actualCellSize.height);
    if (0 == rows) {
    rows = 1;
    }
    NSUInteger cols = _numberOfItems / rows;
    if ( _numberOfItems % rows != 0 )
    cols++;
    */

    return 2; //Testing for iPad
    }

and it does show 2 in one row, but lot of space is blank on the right side.
Screenshot: http://cl.ly/image/1g310C3Q170U

What should I do so these two items fill the screen?

@iprebeg
@evadne
Collaborator
@vburojevic

I tried modifying setDesiredCellSize to make cells bigger but nothing happens. Can you point me where should I edit the code to make cells brigger?

It's difficult without doumentation? There is no documentation for AQGridView right? I tried to find it but failed.

@iprebeg
@vburojevic

I tried:
plainCell = [[ImageDemoGridViewCell alloc] initWithFrame: CGRectMake(0.0, 0.0, 400.0, 300.0) //Doubled the values
reuseIdentifier: PlainCellIdentifier];

but I get an empty view

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment