Comments (8)
I'm not sure if it's possible to have different cell sizes - i hardly think so (but I'm not the author).
If you need to change the size, reloadData is probably the way to go.
from gmgridview.
Yeah you're right, that's a mistake of mine :)
Okay it could be a to-do feature :P
from gmgridview.
I believe the goals of this grid project are different - allowing custom-sized cells is a whole different bag of pain.
You can use same-sized cells and use different size within - so that the absolute border to the next cell is the same.
from gmgridview.
Yes the grid does not support different sizes per cell; it's just a grid.
Support for different sizes per orientation will be added soon though.
from gmgridview.
There are actually 2 ways to approach this. Assume ,for instance, that you want variable heights:
- A GMGridViewLayoutVerticalVariableHeightStrategy that has no access to the datasource.
- it merely caches cell sizes as it produces them, based on previously seen sizes.
- this is much more difficult, and requires more modification in the core code.
- A theme of the changes in core revolve around being able to handle unbounded ranges or sizes, and then checking continuously as new origins are asked for to notice when the range or contentSize is now determined.
- I have hacked together some stuff to do this, but it still suffers from content scrolls that are fast enough to not have asked for all previous cells when asking for a position origin. (since it will not have cached those position frames)
- A VariableHeightLayoutStrategy that is constructed with access to the datasource. It can then maintain its own cache of cell sizes by asking the datasource directly. Less change is needed to the core code for this approach.
- the major theme here, which is also needed in approach 1, is to have the core code act on and pass along the actual cell sizes, instead of the dataSource "size" which in this case is more of a maxSize.
Also, for this type of strategy, it is probably best to convert layout strategies to return NSIndexedSet instead of NSRange, as you may have to say that 0 - 45 is in bounds, but yet only half of those cells may be in bounds depending on how the heights stack up. Without this, your views and cache are bigger than they may need to be, which maybe isn't a big deal.
Note that i've only experimented with getting a layout and scrolling, not with any of the movement/editing/dragging/zooming etc...
from gmgridview.
from gmgridview.
Nice! One other way would be to have blocks in the layoutStrategy classes to compute the cellSizes. So the grid would set the block of the layout strategy and in it's implementation, call the datasource. The layout would just run the block to get the cellSize for each cell whenever needed; this way, the layout strategy doesn't know anything about the data source.
How are the cells aligned at the end of the scroll ?
from gmgridview.
I wasn't sure if you wanted the grid involved, so for now i just construct the strategy with a protocol that produces the sizes.
by aligned, do you mean visually at the bottom of the scroll? however they stack up. You can end up with a bunch of "jagged" white space. although i have an idea for how to make it look better.
from gmgridview.
Related Issues (20)
- How can items drag in both the directions Left to Right and Right to Left ?
- GMGridView reloadData does not refresh view
- Archives has does not contain a single–bundle application or contains multiple products
- iOS 7 Horizontal strategy content size HOT 2
- No document about how to use this control
- if cell width is quite different, grid will show wrong cell when rotating
- ios 5.1 and lower issue HOT 1
- Grid cell want to draw from top HOT 1
- scrollToObjectAtIndex is not working properly when paging is enabled HOT 1
- memory problem - not released/reclaimed HOT 1
- another mem issue
- GMGrid Cell Alignment Issue
- Image stuck on screen
- Sort Help required!
- gridview.edit=yes,how to use sortingdelegate?
- index = -2147483648
- Maybe you can join a group function
- Button not working in subview GMGridviewCell
- Image link in README.md is broken
- animation repeat count doesn't work in GMGridViewCell
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gmgridview.