diff --git a/.gitignore b/.gitignore index a3cd143..4535251 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,4 @@ DerivedData # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control # # Pods/ +.DS_Store diff --git a/JSDropDownMenu/JSDropDownMenu.m b/JSDropDownMenu/JSDropDownMenu.m index 61c0fbf..a7404e5 100644 --- a/JSDropDownMenu/JSDropDownMenu.m +++ b/JSDropDownMenu/JSDropDownMenu.m @@ -676,7 +676,9 @@ - (void)animateCollectionView:(UICollectionView *)collectionView show:(BOOL)show collectionView.frame = CGRectMake(_origin.x, self.frame.origin.y + self.frame.size.height, self.frame.size.width, 0); [self.superview addSubview:collectionView]; - collectionViewHeight = ([collectionView numberOfItemsInSection:0] > 10) ? (5 * 38) : (ceil([collectionView numberOfItemsInSection:0]/2) * 38); +// collectionViewHeight = ([collectionView numberOfItemsInSection:0] > 10) ? (5 * 38) : (ceil([collectionView numberOfItemsInSection:0]/2) * 38); + // fix if collectionView numberOfItemsInSection > 10 or numberOfItemsInSection / 2 != 0 + collectionViewHeight =ceil((CGFloat)[collectionView numberOfItemsInSection:0]/2.0) * 38; } [UIView animateWithDuration:0.2 animations:^{