diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuLayout.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuLayout.mm index df63b54111..7426ef6c69 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuLayout.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuLayout.mm @@ -13,17 +13,18 @@ [UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:indexPath]; CGPoint origin = {}; CGSize size = self.collectionView.frame.size; - CGFloat const position = (CGFloat)indexPath.item / self.buttonsCount; + NSUInteger const buttonsCount = self.buttonsCount; + CGFloat const position = (CGFloat)indexPath.item / buttonsCount; attr.hidden = (size.width == 0.0 || size.height == 0.0); if (size.width > self.layoutThreshold) { - origin = {nearbyint(position * size.width), 0.0}; - size.width = nearbyint(size.width / self.buttonsCount); + origin.x = nearbyint(position * size.width); + size.width = nearbyint(size.width / buttonsCount); } else { - origin = {0.0, nearbyint(position * size.height)}; - size.height = nearbyint(size.height / self.buttonsCount); + origin.y = nearbyint(position * size.height); + size.height = nearbyint(size.height / buttonsCount); } NSAssert(!CGSizeEqualToSize(size, CGSizeZero), @"Invalid cell size"); attr.frame = {origin, size}; @@ -32,8 +33,9 @@ - (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect { - NSMutableArray * attrs = [NSMutableArray arrayWithCapacity:self.buttonsCount]; - for (NSUInteger index = 0; index < self.buttonsCount; index++) + NSUInteger const buttonsCount = self.buttonsCount; + NSMutableArray * attrs = [NSMutableArray arrayWithCapacity:buttonsCount]; + for (NSUInteger index = 0; index < buttonsCount; index++) { NSIndexPath * indexPath = [NSIndexPath indexPathForItem:index inSection:0]; [attrs addObject:[self layoutAttributesForItemAtIndexPath:indexPath]];