Open vburojevic opened 11 years ago
Yeah, this is doable by having custom cells. Post code if you get stuck.
On Dec 5, 2012, at 10:25, "Vedran Burojević" notifications@github.com wrote:
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...
— Reply to this email directly or view it on GitHubhttps://github.com/AlanQuatermain/AQGridView/issues/184.
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.
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?
Create larger cells, aqgridview will adapt to changes. You can also set content insets as desired.
Ivor Prebeg
On Dec 5, 2012, at 7:45 PM, Vedran Burojević notifications@github.com wrote:
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?
— Reply to this email directly or view it on GitHub.
The better approach might be emitting different sizes in the portrait size callback instead of overriding the grid view, then calling reload on rotation in the animation block.
On Dec 5, 2012, at 10:45, "Vedran Burojević" notifications@github.com wrote:
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?
— Reply to this email directly or view it on GitHubhttps://github.com/AlanQuatermain/AQGridView/issues/184#issuecomment-11054554.
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.
not sure how does your code look like, but returning cell with larger frame on cellForItemAtIndex callback should do it.
Ivor Prebeg
On Dec 5, 2012, at 7:53 PM, Vedran Burojević notifications@github.com wrote:
I tried calling 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.
— Reply to this email directly or view it on GitHub.
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
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...