iOS: add enable gallery
This commit is contained in:
parent
3393a474f9
commit
1b105d70e4
@ -25,5 +25,6 @@
|
||||
@property(nonatomic, assign) CGFloat galleryItemWidth;
|
||||
@property(nonatomic, assign) CGFloat galleryMinScale;
|
||||
@property(nonatomic, assign) CGFloat galleryMinAlpha;
|
||||
@property(nonatomic, assign) BOOL enableGallery;
|
||||
@end
|
||||
|
||||
|
@ -24,8 +24,9 @@
|
||||
@implementation DoricSliderLayout
|
||||
|
||||
- (NSArray<UICollectionViewLayoutAttributes *> *)layoutAttributesForElementsInRect:(CGRect)rect {
|
||||
if (self.enableGallery) {
|
||||
NSArray *attributes = [super layoutAttributesForElementsInRect:rect];
|
||||
CGRect visitRect = {self.collectionView.contentOffset,self.collectionView.bounds.size};
|
||||
CGRect visitRect = {self.collectionView.contentOffset, self.collectionView.bounds.size};
|
||||
NSMutableArray *attributesCopy = [NSMutableArray array];
|
||||
for (UICollectionViewLayoutAttributes *attribute in attributes) {
|
||||
UICollectionViewLayoutAttributes *attributeCopy = [attribute copy];
|
||||
@ -50,6 +51,9 @@ @implementation DoricSliderLayout
|
||||
attribute.transform3D = scaleTransform;
|
||||
}
|
||||
return attributesCopy;
|
||||
} else {
|
||||
return [super layoutAttributesForElementsInRect:rect];
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds {
|
||||
|
@ -131,6 +131,7 @@ - (void)blendView:(UICollectionView *)view forPropName:(NSString *)name propValu
|
||||
layout.galleryItemWidth = self.galleryItemWidth;
|
||||
layout.galleryMinScale = self.galleryMinScale;
|
||||
layout.galleryMinAlpha = self.galleryMinAlpha;
|
||||
layout.enableGallery = YES;
|
||||
}
|
||||
|
||||
} else if ([prop isKindOfClass:NSString.class]) {
|
||||
|
Reference in New Issue
Block a user