Coder Social home page Coder Social logo

Comments (7)

JVillella avatar JVillella commented on May 24, 2024

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.

chlebta avatar chlebta commented on May 24, 2024

@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 :
capture d ecran 2015-03-14 a 10 55 44

*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.

JVillella avatar JVillella commented on May 24, 2024

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.

chlebta avatar chlebta commented on May 24, 2024

@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.

JVillella avatar JVillella commented on May 24, 2024

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.

chlebta avatar chlebta commented on May 24, 2024

@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.

JVillella avatar JVillella commented on May 24, 2024

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)

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.