Comments (7)
Hey there @chlebta you are right about the cell column counts being multiples of 2. More information about how the algorithm works can be found on the blog post I've linked from the README. This multiples of 2 behaviour goes hand in hand with the layout algorithm and changing it to something else would require a different process.
Now about the column sizes - they can be changed by implementing collectionView:layout:numberOfColumnsInSection:
in the FMMosiacLayoutDelegate
. Higher column counts mean smaller cell width.
Happy coding!
from fmmosaiclayout.
@JVillella This Will change the height from small to double the height of small cell thats all but i want to use custom height and width. Also the blog link doesn't work .
This is Example what of I I'm talking about :
*So the screen will be divide into 3 column.
*Each column will hold one items.
*the big cell items size will be the double.
I'm new on objective and IOS world but Algorithm and mathematic I got great skills, so if you don't mind we can work's on optimizing this library ?
from fmmosaiclayout.
I see what your saying. Many of us would benefit from more customizable mosaic sizing. If you'd like to try some experiments and see what you can do - that would be awesome! I think the site is up now, give it another try.
from fmmosaiclayout.
@JVillella Yes the site work's now and I'm will give try to optimize this library and make it more simple and customizable 👍 also can I get your email to talk directly and in case of trouble.
from fmmosaiclayout.
That would be great thanks! My email is in the podspec of the repo's root. So that others can learn from your progress it may be best to keep our chats on this thread. I reply quickly either way.
from fmmosaiclayout.
@JVillella Hello, is there any rapid hack to add third type of Cell (where width = 2*Small Cell width ; and height = normal small Cell height) ?
Also can you make the code more commented I'm working on solution to make it more dynamic as we talked .
from fmmosaiclayout.
The algorithm asks the FMMosaicLayoutDelegate
for the type of mosaic cell size (either FMMosaicCellSizeBig
, or FMMosaicCellSizeSmall
- half the size of big). This is done in:
- (FMMosaicCellSize)collectionView:(UICollectionView *)collectionView
layout:(FMMosaicLayout *)collectionViewLayout
mosaicCellSizeForItemAtIndexPath:(NSIndexPath *)indexPath;
We work in columns, which again is provided by the delegate in:
- (NSInteger)collectionView:(UICollectionView *)collectionView
layout:(FMMosaicLayout *)collectionViewLayout
numberOfColumnsInSection:(NSInteger)section;
We use a buffer to store small cells until we have 2 (enough to fill the width of a column). This is when we actually add it to our column heights array property (currently named columnHeightsInSection
) and our layout attributes property (currently named layoutAttributes
).
If we have leftover small cells after this process (because there weren't 2 to pair together) we handle them separately (see the commented code block about this).
The column heights property maintains the height of each column in each section. It's a 2D array - an array of sections, and heights per column in each section.
The majority of the rest of code deals with UICollectionViewLayout
specifics. You said you were new to iOS and Objective-C. A book that helped me understand them better when I was learning was iOS UICollectionView: The Complete Guide as well as this article about combining UICollectionView
and UIDynamics
. It goes a lot into how the layouts work. Both resources are written by @ashfurrow.
there any rapid hack to add third type of Cell (where width = 2*Small Cell width; and height = normal small Cell height)?
Yes this can be done. It's relatively similar to how the small cells are buffered and then added to those two properties (cell heights array, layout attributes). This shouldn't be hard to do - probably a few lines.
Good luck. Hope that helps!
from fmmosaiclayout.
Related Issues (16)
- ability to change number of image in one row HOT 2
- Can't get the Example Project to work HOT 3
- Add support for FMMosaicCellSizeTall and FMMosaicCellSizeWide. HOT 2
- How to change the scroll direction? HOT 1
- How to add cell size medium ? HOT 2
- Deleting an item causes layout not working correctly. HOT 1
- issues with build.
- More options for cell size? HOT 3
- setting numberOfColumnsInSection to odd number HOT 2
- Get rid of delegate in favor of self.collectionView.delegate HOT 2
- How to Add Header and Footer View? HOT 2
- Release 0.1.2 breaks UI in landscape mode HOT 2
- Calculate mosaic cell size placement to always end flush
- Add support for inserting, removing, and moving cells with animations
- SWIFT. HOT 3
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 fmmosaiclayout.