File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -206,9 +206,12 @@ - (void)setSelectionIndicatorBoxOpacity:(CGFloat)selectionIndicatorBoxOpacity
206206- (CGSize)measureTitleAtIndex : (NSUInteger )idx {
207207 id title = self.sectionTitles [idx];
208208 CGSize size = CGSizeZero;
209- if ([title isKindOfClass: [NSString class ]]) {
210- NSDictionary *titleAttrs = idx == self.selectedSegmentIndex ? [self resultingSelectedTitleTextAttributes ] : [self resultingTitleTextAttributes ];
209+ BOOL selected = idx == self.selectedSegmentIndex ;
210+ if ([title isKindOfClass: [NSString class ]] && self.titleFormatter == nil ) {
211+ NSDictionary *titleAttrs = selected ? [self resultingSelectedTitleTextAttributes ] : [self resultingTitleTextAttributes ];
211212 size = [(NSString *)title sizeWithAttributes: titleAttrs];
213+ } else if ([title isKindOfClass: [NSString class ]] && self.titleFormatter != nil ) {
214+ size = [self .titleFormatter (self , title, selected) size ];
212215 } else if ([title isKindOfClass: [NSAttributedString class ]]) {
213216 size = [(NSAttributedString *)title size ];
214217 } else {
You can’t perform that action at this time.
0 commit comments