简体   繁体   中英

Change the font size and font style of UISearchBar UISegmentedControl in iOS 7

How can I change the font of the UIButtons in the scope bar of a UISearchBar? The font of the UISearchBar input I have already changed but this does not change it for the scope bar.

在此处输入图片说明

With this code I changed the UISearchBar text font and color in my AppDelegate.m.

[[UITextField appearanceWhenContainedIn:[UISearchBar class], nil] setDefaultTextAttributes:@{NSForegroundColorAttributeName:FONT_COLOR, NSFontAttributeName:NAVIGATION_BAR_FONT}];

u can use this code:

UIFont *font = [UIFont fontWithName:@"ur font name" size:10];
NSDictionary *attributes = [NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName]; 
[your segmentName setTitleTextAttributes:attributes forState:UIControlStateNormal];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM