4

出于某种原因,我的分段控件中的字体不是垂直居中的。有没有办法将字体向上移动以垂直居中?

截屏

我对它们进行的唯一设置如下(声明活动/非活动/分隔符图像除外):

NSDictionary *normalSegmentedControlAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
                                  [UIColor blackColor], UITextAttributeTextColor,
                                  [UIColor clearColor], UITextAttributeTextShadowColor,
                                  [NSValue valueWithUIOffset:UIOffsetMake(0, 1)], UITextAttributeTextShadowOffset,
                                  [UIFont fontWithName:kFont size:kSegConFontSize], UITextAttributeFont,
                                  nil];
[[UISegmentedControl appearance] setTitleTextAttributes:normalSegmentedControlAttributes forState:UIControlStateNormal];

NSDictionary *selectedSegmentedControlAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
                                    [UIColor whiteColor], UITextAttributeTextColor,
                                    [UIColor clearColor], UITextAttributeTextShadowColor,
                                    [NSValue valueWithUIOffset:UIOffsetMake(0, 1)], UITextAttributeTextShadowOffset,
                                    [UIFont fontWithName:kFont size:kSegConFontSize], UITextAttributeFont,
                                    nil];
[[UISegmentedControl appearance] setTitleTextAttributes:selectedSegmentedControlAttributes forState:UIControlStateSelected];
4

0 回答 0