hey everyone,
i love this reorderable flowlayout and i tried to use it in a project where im changing the cell sizes with a uislider.
everything works grate until the cells are reaching a size where they can fit only one per line.
then the following thing happens:
does anyone have any idea why this happens ?
to enable zooming i added the following code to the sample demo with the cards:
in LXCollectionViewController.h file
@Property (strong, nonatomic) UISlider *zoomController;
@Property (nonatomic) CGFloat zoomLevel;
and in LXCollectionViewController.m file
-(IBAction)sliderValueChanged:(UISlider *)sender
{
self.zoomLevel = self.zoomController.value;
[self.collectionView reloadData];
[self.collectionView.collectionViewLayout invalidateLayout];
}
-
(CGSize)collectionView:(UICollectionView )collectionView layout:(UICollectionViewLayout)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
return CGSizeMake(160 + self.zoomLevel, 240 + self.zoomLevel);
}
-(void) addZoomController {
self.zoomController = [[UISlider alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height - 50, self.view.frame.size.width, 50)];
[self.zoomController addTarget:self action:@selector(sliderValueChanged:)
forControlEvents:UIControlEventValueChanged];
self.zoomController.minimumValue = -400;
self.zoomController.maximumValue = 400;
self.zoomLevel = 0;
[self.view addSubview:self.zoomController];
}
-
(void)viewDidLoad {
[super viewDidLoad];
self.deck = [self constructsDeck];
[self addZoomController];
}