Giter VIP home page Giter VIP logo

Comments (9)

AlanQuatermain avatar AlanQuatermain commented on August 24, 2024

Yeah, it's an artifact of how it handles indexing— it counts along each row. For horizontal scrolling I'm not entirely certain what the ideal format would be. Keeping the same thing might not be the best thing, and it would definitely require a change to the way I'm tracking which items are visible (I wouldn't be able to use a range any more, I'd have to use an NSIndexSet).

In Kobo we're only using this mode with a single row (in the 'I'm Reading' expose-style overlay), so we don't hit this problem. The ImageDemo I modified here to show off horizontal scrolling does though, which is somewhat annoying. I've just not gotten around to making a decision yet how it ought to be done, or whether there should be a developer setting for it.

from aqgridview.

darknoon avatar darknoon commented on August 24, 2024

Hey, I'd really like to see the horizontal scrolling work. Is this something that you're going to be putting time into?

I might be able to help implement it, but I think I would need to understand the code base a little deeper. I implemented a general solution to this problem that looked somewhat different (arbitrary rects and visibility testing, different layout manager for vert / horiz), but unfortunately it's owned by eBay :(

from aqgridview.

syedhassan4 avatar syedhassan4 commented on August 24, 2024

I am also trying to implement horizontal scrolling in SINGLE row. But when I run application gives me Vertical scrolling as well, which I don't need. I only required horizontal scrolling in the gridview. Horizontal scrolling working fine, I just need to fix vertical scrolling.

Here is my UI setup and code,

  1. MyCustom view in which I place AQGridView. My Custom view height is 110px as well AQGridView height is 110px.
  2. For AQGridViewCell, I took some different approach (since I more in favour of IB). So I created a view 110x110 (width x height) and add it in gridview's as subview in contentview:

//In MyCustomView.m
-(void)awakeFromNib {
//self.gridView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
self.gridView.autoresizesSubviews = NO; //Also tried with YES
self.gridView.delegate = self;
self.gridView.dataSource = self;

self.gridView.layoutDirection = AQGridViewLayoutDirectionHorizontal;
self.gridView.separatorStyle = AQGridViewCellSeparatorStyleEmptySpace;
self.gridView.resizesCellWidthToFit = NO;
self.gridView.separatorColor = nil;

}

  • (AQGridViewCell_)gridView:(AQGridView_)aGridView cellForItemAtIndex:(NSUInteger)index {

    AQGridViewCell * cell = [aGridView dequeueReusableCellWithIdentifier:[GridItemView gridItemViewIdentifier]];
    if(cell == nil) {
    cell = [[[AQGridViewCell alloc] initWithFrame: CGRectMake(0.0, 0.0, 110.0, 110.0)
    reuseIdentifier:[GridItemView gridItemViewIdentifier]] autorelease];
    [cell.contentView addSubview:[GridItemView createGridItemview]];

    cell.contentView.backgroundColor = [UIColor clearColor];
    cell.backgroundColor = [UIColor clearColor];
    cell.contentView.opaque = NO;
    cell.opaque = NO;
    
    cell.selectionGlowColor = [UIColor blueColor];
    

    }
    //....
    return cell;
    }

  • (CGSize)portraitGridCellSizeForGridView:(AQGridView*)aGridView {
    return CGSizeMake(110.0, 110.0);
    }

//In GridItemView.m
+(id)createGridItemview {
return [[[NSBundle mainBundle] loadNibNamed:@"GridItemView" owner:self options:nil] lastObject];
}

from aqgridview.

syedhassan4 avatar syedhassan4 commented on August 24, 2024

I think I found the issue.

Issue is in the (void) setContentSize: (CGSize) newSize function. There is a line
newSize.height = fmax(newSize.height, self.frame.size.height+1); which is creating issue so I changed it with following code. Please let me know, you see any issue in the updated code.

if(self.layoutDirection == AQGridViewLayoutDirectionHorizontal)
    newSize.height = fmax(newSize.height, self.frame.size.height);
else
    newSize.height = fmax(newSize.height, self.frame.size.height+1);

It fixes the vertical scrolling issue in Single Row Horizontal gridview.

from aqgridview.

adsahay avatar adsahay commented on August 24, 2024

What's the status of this issue? Using a range to define visible cells won't work in multi-row horizontal scrolling, NSIndexPath sounds better. Is someone working on this (I am not expert enough to fix it myself)?

from aqgridview.

coreyfloyd avatar coreyfloyd commented on August 24, 2024

Found a branch with a partial fix. They moved to an index set.

https://github.com/marcammann/AQGridView/

So far it seems to work.

I am working on the other part, which is to re-layout the indexes into the logical pages. That is to say page 0 should contain indexes 0-19, page 1 20-29, etc…

from aqgridview.

nbonatsakis avatar nbonatsakis commented on August 24, 2024

Any word on how this is coming? I'd like to use this library for a single row, paged scrolling grid view. It sounds like this would be needed.

from aqgridview.

Ricardo1980 avatar Ricardo1980 commented on August 24, 2024

I think I also see that error.
"*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: range.location + range.length <= [_visibleCells count]'"

I created a grid on the iPad and I always see it when I rotate it several times.
Any suggestion or idea about how to fix this?
This is a nice lib and works ok for me except that detail.

from aqgridview.

imrano16 avatar imrano16 commented on August 24, 2024

My AQGridView Horizontal scrolling is not working

and get the following error...
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* setObjectForKey: key cannot be nil'
*** First throw call stack:
(
0 CoreFoundation 0x0048c5e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x0382a8b6 objc_exception_throw + 44
2 CoreFoundation 0x00516578 -[__NSDictionaryM setObject:forKey:] + 888
.
.
.

from aqgridview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.