Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions SMVerticalSegmentedControl/SMVerticalSegmentedControl.m
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ - (void)drawRect:(CGRect)rect
self.layer.sublayers = nil;

[self.sectionTitles enumerateObjectsUsingBlock:^(id titleString, NSUInteger idx, BOOL *stop) {
CGFloat stringHeight = [self getTextHeight:titleString];
CGFloat stringHeight = [self getTextHeight:NSLocalizedString(titleString, @"")];
CGFloat y = self.segmentHeight * idx + self.segmentHeight / 2 - stringHeight / 2;

/*
Expand Down Expand Up @@ -158,7 +158,7 @@ - (void)drawRect:(CGRect)rect
break;
}

[titleLayer setString:titleString];
[titleLayer setString:NSLocalizedString(titleString, @"")];

// Use visibileSelectedSegmentIndex for highlighting segment text instead of selectedSegmentIndex
// This is necessary for proper selection animation
Expand Down Expand Up @@ -208,7 +208,7 @@ - (CGRect)frameForSelectionIndicator

CGFloat sectionHeight = 0.0f;

NSString *title = self.sectionTitles[self.selectedSegmentIndex];
NSString *title = NSLocalizedString(self.sectionTitles[self.selectedSegmentIndex], @"");
CGFloat stringHeight = [self getTextHeight:title];
sectionHeight = stringHeight;

Expand All @@ -234,7 +234,8 @@ - (void)updateSegmentsRects:(CGSize)size
self.segmentHeight = 0;

for (NSString *titleString in self.sectionTitles) {
CGFloat stringHeight = [self getTextHeight:titleString] + self.segmentEdgeInset.top + self.segmentEdgeInset.bottom;
CGFloat stringHeight = [self getTextHeight:NSLocalizedString(titleString, @"")]
+ self.segmentEdgeInset.top + self.segmentEdgeInset.bottom;
self.segmentHeight = MAX(stringHeight, self.segmentHeight);
}
self.frame = CGRectMake(0, 0, self.width, self.segmentHeight * self.sectionTitles.count);
Expand Down