Giter VIP home page Giter VIP logo

Comments (6)

AlanQuatermain avatar AlanQuatermain commented on July 3, 2024

I'm not sure how I'm supposed to detect that I have to handle that in code— the only way I know off the top of my head involves watching the view hierarchy, but that would mean checking for private classes (i.e. UITransitionView). I'd always assumed that this was something which was done for me by the navigation controller.

from aqgridview.

luciuskwok avatar luciuskwok commented on July 3, 2024

When I stepped through the code, I noticed that the contentOffset of the AQGridView was set to {0, -44} when in portrait mode with a translucent nav bar. I believe it's set to {0, -38} in landscape because the nav bar is shorter in landscape. There's two changes that fix this issue. One is in AQGridView, there are two places where instead of using CGPointEqualToPoint() to compare to CGPointZero, compare point.y <= 0.0f.

The second change has to do with the way the content size is calculated. I turned off contentSizeGrowsToFillBounds but it was still expanding the content size to the bounds, and it also wasn't taking into account the negative content offset. As I was stepping through the code I noticed that in AQGridViewData, in sizeForEntireGrid, it sets the height of the grid to the height of the bounds, without checking if the flag that I set to no. So deleted the two lines with if statement that sets height = _gridView.bounds.size.height.

In -[AQGridView setContentSze:] it looks like it should take into account a negative content offset when calculating the size to fill the bounds.

I'm not sure if I should make a fork with the changes or if it'll be easier if you make them yourself.

from aqgridview.

AlanQuatermain avatar AlanQuatermain commented on July 3, 2024

Thanks Lucius.

Feel free to make a fork and update the code; it looks like it might be a couple more days before I can get back onto it myself.

from aqgridview.

luciuskwok avatar luciuskwok commented on July 3, 2024

I found a lot more bugs with using it with a black translucent nav bar, related to the assumption that the contentOffset would be non-negative. I don't have time now to go through and fix it so I don't have a fork.

from aqgridview.

evadne avatar evadne commented on July 3, 2024

I don’t think we must support an initial negative content offset, although the code not working correctly under this case is a bug; here are a few solutions that will probably work:

  • Wrap the entire grid view in another view, with a 44-pixel space between the grid view’s top margin and the enclosing view’s top margin
  • Increase the top content inset of the grid view (it’s a scroll view after all).

Good things about the second solution: a) I like it; b) I use it a lot; and c) when you tell the grid view to scroll to CGPointZero, it scrolls to the correct position, and inertial scrolling will bounce the entire view back to the correct position too.

from aqgridview.

evadne avatar evadne commented on July 3, 2024

Closing as Workaround Provided. Feel free to re-open this issue :)

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.