Code Monkey home page Code Monkey logo

rfquiltlayout's People

Contributors

bryceredd avatar danielrhammond avatar eddyborja avatar goles avatar ppeelen avatar sdkdimon avatar spacyricochet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rfquiltlayout's Issues

Using library without storyBoard

Hello, How can I use this library without storyBoard ( because in my code I'm drawing tableView programmatically ) , I tried something like this but didn't worked and MyCollectionView never called and layout is always nil :

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    //self.view.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:self.collectionView];

    [_collectionView registerNib:[UINib nibWithNibName:@"myCell" bundle:nil] forCellWithReuseIdentifier:@"cell3"];
    [_collectionView setBackgroundColor:[UIColor colorWithRed:0.945 green:0.945 blue:0.945 alpha:1] ];
    [_collectionView setTransform:CGAffineTransformMakeScale(-1, 1)];

    RFQuiltLayout* layout = (id)[_collectionView collectionViewLayout];
    layout.direction = UICollectionViewScrollDirectionVertical;
    layout.blockPixels = CGSizeMake(100, 100);
}


- (UICollectionView *)collectionView {
    if (!_collectionView) {
        CGRect collectionViewFrame = self.view.bounds;
        collectionViewFrame.size.height -= (self.navigationController.viewControllers.count > 1 ? 0 : (CGRectGetHeight(self.tabBarController.tabBar.bounds))) + 0;
        //        FMMosaicLayout *mosaicLayout = [[FMMosaicLayout alloc] init];
        ////        _collectionView = [[UICollectionView alloc] initWithFrame:collectionViewFrame collectionViewLayout:mosaicLayout];
//                RFQuiltLayout* layout = (id)[_collectionView collectionViewLayout];
//                layout.direction = UICollectionViewScrollDirectionVertical;
//                layout.blockPixels = CGSizeMake(100, 100);
        _collectionView = [[UICollectionView alloc] initWithFrame:collectionViewFrame collectionViewLayout:[[RFQuiltLayout alloc] init]];
        _collectionView.delegate = self;
        _collectionView.dataSource = self;

    }
    return _collectionView;
}

Margin error

Hi, i've a problem with margins. How i set margin to leading and trailing to superview? My auto layout constraint are correct:

ios simulator screen shot 25 gen 2015 13 09 43

Two colums in different rows

Hi everybody, thanks for such a good framework like this.

I have a problem when I try to form something like this:
2jh5a

What I get is this
cbspd

This is the code I've used:

  • (void)viewDidLoad
    {
    ...
    RFQuiltLayout* layout = (id)[self.collectionView collectionViewLayout];
    layout.direction = UICollectionViewScrollDirectionVertical;
    layout.blockPixels = CGSizeMake(150, 220);
    }
  • (CGSize) blockSizeForItemAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.row == 0) {
    return CGSizeMake(1, 0.5);
    } else {
    return CGSizeMake(1, 1);
    }
    }

Disappearing UICollectionViewCells on Add

Set a larger size for the UICollectionViewCells, horizontal scrolling and default 50 objects. Scroll to the end of the UICollection. Tap the Add button. You will see the the UICollectionViewCells disappearing (38 - 43) and came back on when you tap the Add button again. Any suggestion how to fix / debug this?

This is what I set for RFViewController's viewDidLoad, layout.blockPixels = CGSizeMake(310, 225), and at blockSizeForItemAtIndexPath returning only CGSizeMake(1.0, 1.0).

screen shot 2013-06-15 at 1 44 30 am
screen shot 2013-06-15 at 1 43 39 am

Each box when tapped has to be expanded from the same position

I wanted 3 boxes in a single row with the same size. When user taps on any box, it must get enlarged & the other items have to get aligned accordingly.

I am using the same code given in RFQuiltLayout, but made a few changes as given below.

- (void)viewDidLoad {
    .....
    RFQuiltLayout* layout = (id)[self.collectionView collectionViewLayout];
    layout.direction = UICollectionViewScrollDirectionVertical;
    layout.blockPixels = CGSizeMake(97,97);
    [self.collectionView reloadData];
}


- (void) setNumberArrays {

    [self.numbers removeAllObjects];
    [self.numberWidths removeAllObjects];
    [self.numberHeights removeAllObjects];

    for (NSInteger i = 0; i< [[self.entries objectAtIndex:0] count]; i++) {

        [self.numbers addObject:@(i)];
        if (i == AppDelegateObj.bigBoxIndex) {
            [self.numberWidths addObject:@(2)];
            [self.numberHeights addObject:@(2)];
        }
        else {
            [self.numberWidths addObject:@(1)];
            [self.numberHeights addObject:@(1)];
        }
    }
}


- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
    if (AppDelegateObj.bigBoxIndex == -1) {
        AppDelegateObj.bigBoxIndex = indexPath.row;
    }
    else {
        AppDelegateObj.bigBoxIndex = -1;
    }
    [self setNumberArrays];
    if(!self.numbers.count || indexPath.row > self.numbers.count) return;
    if(isAnimating) return;
    isAnimating = YES;
    [self.collectionView performBatchUpdates:^{
        [self.collectionView reloadData];
    } completion:^(BOOL done) {
        isAnimating = NO;
    }];
}

screen shot 2014-04-29 at 4 37 53 pm

When user taps on a box, I am just reassigning the arrays 'self.numbers', 'self.numberWidths', 'self.numberHeights' & reloading the UICollectionView.

Suppose user taps on 2, as per the current code the below is happening,

screen shot 2014-04-29 at 4 38 10 pm

But I want the output to look like,

screen shot 2014-04-29 at 4 54 34 pm

Please suggest what is the change to be made on code. I tried a lot to change. But failed :(

Ordering issue

Dear Sir
I realised that the layout chooses the best fit space to calculate position of the next element, how to make a minor change to make the position of elements by their ordinary order (to the last of the elements)

Thanks

Reload initial content on viewDidAppear

Hello I've spent a bit of time on this and can't seem to wrap my hear around it. I am using RFQuiltLayout with a menu that alternates it between a rear and front view controller. When I bring the RFQuiltLayout from the rear to the front again, the view controller does not reload the quilt and is just black. I noticed the example contained:

  • (void) viewDidAppear:(BOOL)animated {
    [self.collectionView reloadData];
    }

Which I thought would refresh the quilt. Any ideas or pointers would be greatly appreciated.

Thank you

Android port

Anyone know of equivalent project for Android using RecyclerView?
It must not use any pre-defined patterns.
RFQuiltLayout is using bin-packing algorithm, isn't it?

Carthage support?

Carthage 0.15.2 reports this error when attempting to build RFQuiltLayout:

Dependency "RFQuiltLayout" has no shared framework schemes for any of the platforms: iOS

How to use RFQuiltLayout with a Swift project

Hi,
I'm a iOS newbie and have a Swift project, how do I use RFQuiltLayout with it? Do I import it via ProjectName-Bridging-Header? I've copied RFQuiltLayout.m & RFQuiltLayout.h files to a folder within my project and then called #import "RFQuiltLayout.h" in the Bridging-Header file. However, when I try to change the Custom Class for the Collection View Flow Layout of a Collection View, RFQuiltLayout doesn't show up.

Content Inset is missing.

We all use content inset on top and bottom for both UITableView and UICollectionView for several purposes.

But here contentInset is missing.. If we have a property for setting the contentInset, that would be great.

iOS 8 problem

Hello,

It seems that in iOS 8 RFQuiltLayout is not working well, it resize the space of each cell but the cell is not resizing at all.

What is the problem here?

Way to use RFQuiltLayout

This is more open for discussion than an issue. The current way to use RFQuiltLayout requires a block size which can take a long time to load if set to low numbers. I wonder if there is another way to do this that uses the regular cell sizes but is fast with a lot of small cells.

Delegate Methods

Hello. Please make delegate methods of the layout to apple style, for easy manage of multiple collection views.
Delegate mehtods:

  • (CGSize) blockSizeForItemAtIndexPath:(NSIndexPath *)indexPath;
  • (UIEdgeInsets) insetsForItemAtIndexPath:(NSIndexPath *)indexPath;
    i am can not recognize which grid view called them.
    So my propose is:
  • (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)layout blockSizeForItemAtIndexPath:(NSIndexPath *)indexPath;
  • (UIEdgeInsets) collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)layout insetsForItemAtIndexPath:(NSIndexPath *)indexPath;
    It gives elegant access to UICollectionView and its layout. Thanks. Sorry for my English.

Sections in QuiltView

I am trying to create sections in my view controller with respect to the QuiltViewLayoutDelegate, however it doesn't work. I am using your demo and edited the method numberOfSectionsInCollectionView. Is the problem within your third party? If so where can i find it?

Auto Resizing Tiles

Hello,
I have been playing with RFQuiltLayout.
Basically I need a layout like ZigZag tiles, something like this
|^|
|^
|
|**^|

The first three rows gets drawn properly but later it auto resize the tiles and start messing with it.
Anyone can help?

screenshot 2013 11 18 17 03 53

Here is the code:
int counter = 4;

pragma mark โ€“ RFQuiltLayoutDelegate

- (CGSize) blockSizeForItemAtIndexPath:(NSIndexPath *)indexPath {

NSLog(@"%d and Row: %d",counter % 4, indexPath.row);

if(counter % 4 >= 2)
{
    counter++;

    if(indexPath.row >= self.numbers.count)
        NSLog(@"Asking for index paths of non-existant cells!! %d from %d cells", indexPath.row, self.numbers.count);

    if (indexPath.row % 2 == 0) {
        return CGSizeMake(2, 1);
    }else
    {
        return CGSizeMake(1, 1);
    }
}
else
{
    counter++;
    if(indexPath.row >= self.numbers.count)
        NSLog(@"Asking for index paths of non-existant cells!! %d from %d cells", indexPath.row, self.numbers.count);

    if (indexPath.row % 2 == 0) {
        return CGSizeMake(1, 1);
    }else
    {
        return CGSizeMake(2, 1);
    }
  }


}

Crash

When I tested this the demo app crashes when you remove all items and attempt to add one. I believe this happens because you mod by 0 in your add method. Just a heads up.

Header

Hi, I use your Layout but if I want show multiple sections with headers, it's not posible, because the header section never get call. What I need to do to show multiple sections and headers??

Thanks iun advance

collectionViewContentSize should return final, maximum size

I believe the collectionViewContentSize should return the full size of the layout. Right now it only returns down to the furthestBlockPoint+1, so If you just load the layout, and haven't scrolled down, the content size is incorrect. This causes the scrolling indicators to jump around as you scroll and layout the rest of the cells.

I assume you are planning to implement something like this due to the unused 'prelayoutEverything' property.

I can try to take a stab at fixing it, but I will have to familiarize myself with the code, let me know if you have any suggestions.

Cell Size based on content?

Hey, I'm just wondering how I should use this for printing labels inside the cells.
If I return the label size in the blockSizeForItemAtIndexPath: method it makes the cell way to big because its multiplying it by the blockPixels or something of that nature.

Any ideas?

M

reloadData causes jump

Whenever I call reloadData and I add a couple more cells the view jumps back to some start cell. This causes the experience to be really bad and feels horrible

I am laying out my block size using this

- (CGSize)blockSizeForItemAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.row % 7 == 0){
        return CGSizeMake(3, 3);
    }
    else if(indexPath.row % 5 == 0)
        return CGSizeMake(2, 1);

    return CGSizeMake(1, 1);
}

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.