#import "UISegmentedControl+Font.h"
@implementation UISegmentedControl(Font)
- (void)setFont:(UIFont *)font color:(UIColor *)color {
NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:font, NSFontAttributeName, [UIColor blackColor], NSForegroundColorAttributeName, nil];
[self setTitleTextAttributes:attributes forState:UIControlStateNormal];
NSDictionary *highlightedAttributes = [NSDictionary dictionaryWithObject:[UIColor whiteColor] forKey:NSForegroundColorAttributeName];
[self setTitleTextAttributes:highlightedAttributes forState:UIControlStateSelected];
}
@end
沒有留言:
張貼留言