在分段控制器中垂直居中字体

时间:2012-12-31 19:28:37

标签: ios

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

Screenshot

我正在设置的唯一设置如下(除了声明活动/非活动/分隔图像):

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];

0 个答案:

没有答案