diff --git a/HMSegmentedControl/HMSegmentedControl.m b/HMSegmentedControl/HMSegmentedControl.m index f73e3e6a..d7650a3f 100755 --- a/HMSegmentedControl/HMSegmentedControl.m +++ b/HMSegmentedControl/HMSegmentedControl.m @@ -250,8 +250,6 @@ - (CGSize)measureTitleAtIndex:(NSUInteger)index { if ([title isKindOfClass:[NSString class]] && !self.titleFormatter) { NSDictionary *titleAttrs = selected ? [self resultingSelectedTitleTextAttributes] : [self resultingTitleTextAttributes]; size = [(NSString *)title sizeWithAttributes:titleAttrs]; - UIFont *font = titleAttrs[@"NSFont"]; - size = CGSizeMake(ceil(size.width), ceil(size.height-font.descender)); } else if ([title isKindOfClass:[NSString class]] && self.titleFormatter) { size = [self.titleFormatter(self, title, index, selected) size]; } else if ([title isKindOfClass:[NSAttributedString class]]) { @@ -323,7 +321,7 @@ - (void)drawRect:(CGRect)rect { BOOL locationUp = (self.selectionIndicatorLocation == HMSegmentedControlSelectionIndicatorLocationUp); BOOL selectionStyleNotBox = (self.selectionStyle != HMSegmentedControlSelectionStyleBox); - CGFloat y = roundf((CGRectGetHeight(self.frame) - selectionStyleNotBox * self.selectionIndicatorHeight) / 2 - stringHeight / 2 + self.selectionIndicatorHeight * locationUp); + CGFloat y = (CGRectGetHeight(self.frame) - selectionStyleNotBox * self.selectionIndicatorHeight) / 2 - stringHeight / 2 + self.selectionIndicatorHeight * locationUp; CGRect rect; if (self.segmentWidthStyle == HMSegmentedControlSegmentWidthStyleFixed) { rect = CGRectMake((self.segmentWidth * idx) + (self.segmentWidth - stringWidth) / 2, y, stringWidth, stringHeight);