uifont

Change font of back navigation bar button

你离开我真会死。 提交于 2019-11-27 18:06:44
I want to be able to set the font of my apps navigation bar back button without doing anything too crazy and without losing any other design characteristics of the button (i.e. I want to keep the arrow). Right now I use this in viewDidAppear: to set the font of the normal bar button items. for (NSObject *view in self.navigationController.navigationBar.subviews) { if ([view isKindOfClass:[UIButton class]]) { [((UIButton*)view).titleLabel setFont:[UIFont fontWithName:@"Gill Sans" size:14.0]]; } } However this makes no change on the back button, regardless of which UIViewController this code is

Custom UIFont baseline shifted

ε祈祈猫儿з 提交于 2019-11-27 17:49:51
I'm having a problem with custom UIFonts. I load 6 of them (font A in regular/bold/regularItalic/boldItalic, font B in condensed/condensedSlanted variants). However, here is what it gives when rendered: The two first rows are OK, but the last one exhibits a baseline problem. I've tried changing the UPM, ascender, descender, x-height of the font in FontLab so that it matches the first font's values (which render correctly), but to no avail. I've tried converting the font format from OTF to TTF, no luck. Whatever I try, it always renders this way. Does anyone have experience with this? art-divin

Change the font size of UISearchBar

百般思念 提交于 2019-11-27 17:49:18
How can I change the font size of UISearchBar ? Edit: Answer for(int i =0; i<[searchbar.subviews count]; i++) { if([[searchbar.subviews objectAtIndex:i] isKindOfClass:[UITextField class]]) [(UITextField*)[searchbar.subviews objectAtIndex:i] setFont:[UIFont fontWithName:@"Helvetica" size:12]]; } Thanks Pankaj The UISearchBar has a UITextField inside, but there's no property to access it. So, there is no way for doing it in a standard way. But there is a non-stardard way to workaround it. UISearchBar inherits from UIView, you can access it's subviews using [searchBar subviews]. If you print in

iPhone SDK 3.2 and UIAppFonts

百般思念 提交于 2019-11-27 15:08:43
问题 I've added my custom font to UIAppFonts and it's loaded just fine: (shows up in [UIFont familyNames] ). When I manually set the font in viewDidLoad { [myLabel setFont: [UIFont fontWithName:@"CustomFont" size: 65.0]]; } everything works and the font is rendered. However doing the same thing in IB doesn't (some other default font is used instead). Having to create IBOutlets for each label and fixing up the fonts manually in viewDidLoad is pretty painful. Anyone else had problems getting the

Setting UILabel - Font through code - generates error - iPhone

帅比萌擦擦* 提交于 2019-11-27 13:27:25
问题 See following code carefully. Because it works perfectly. Try to add in your application. it will work - (void)viewDidLoad { [super viewDidLoad]; // title label - tip UILabel *tmp=[[UILabel alloc] initWithFrame:CGRectMake(50, 50, 200, 200)]; tmp.textColor=[UIColor colorWithRed:(14.0/255.0) green:(105.0/255) blue:(128.0/255) alpha:1.0]; [tmp setFont:[UIFont fontWithName:@"Arial" size:18]]; tmp.text=@"sagar"; tmp.backgroundColor=[UIColor clearColor]; [self.view addSubview:tmp]; [tmp release]; }

How to change an UILabel/UIFont's letter spacing?

末鹿安然 提交于 2019-11-27 11:19:58
I've searched loads already and couldn't find an answer. I have a normal UILabel, defined this way: UILabel *totalColors = [[[UILabel alloc] initWithFrame:CGRectMake(5, 7, 120, 69)] autorelease]; totalColors.text = [NSString stringWithFormat:@"%d", total]; totalColors.font = [UIFont fontWithName:@"Arial-BoldMT" size:60]; totalColors.textColor = [UIColor colorWithRed:221/255.0 green:221/255.0 blue:221/255.0 alpha:1.0]; totalColors.backgroundColor = [UIColor clearColor]; [self addSubview:totalColors]; And I wanted the horizontal spacing between letters, to be tighter, whilst mantaining the font

How to get monospaced numbers in UILabel on iOS 9

随声附和 提交于 2019-11-27 10:50:42
问题 At WWDC 2015, there was a session about the new “San Francisco” system font in iOS 9. It uses proportional number rendering instead of monospaced numbers by default when linked against the iOS 9 SDK. There is a convenient initializer on NSFont called NSFont.monospacedDigitsSystemFontOfSize(mySize weight:) that can be used to explicitly enable monospaced number display. However I couldn't find the UIKit equivalent for this on UIFont . 回答1: Handy UIFont extension: extension UIFont { var

UIFont - how to get system thin font

冷暖自知 提交于 2019-11-27 10:35:26
UIFont has methods to get regular font ( systemFontOfSize ) or bold font ( boldSystemFontOfSize ), but how to get a "thin system font" available through storyboard? Passing "system-thin" to UIFont Contructor doesn't work, this constructor only works for non system fonts. s1ddok You can use system font thin weight: UIFont.systemFont(ofSize: 34, weight: UIFontWeightThin) List of available weights for San Francisco: UIFontWeightUltraLight UIFontWeightThin UIFontWeightLight UIFontWeightRegular UIFontWeightMedium UIFontWeightSemibold UIFontWeightBold UIFontWeightHeavy UIFontWeightBlack As of iOS 11

How to change font of UIButton with Swift

主宰稳场 提交于 2019-11-27 09:16:27
问题 I am trying to change the font of a UIButton using Swift... myButton.font = UIFont(name: "...", 10) However .font is deprecated and I'm not sure how to change the font otherwise. Any suggestions? 回答1: Use titleLabel instead. The font property is deprecated in iOS 3.0. It also does not work in Objective-C. titleLabel is label used for showing title on UIButton . myButton.titleLabel?.font = UIFont(name: YourfontName, size: 20) However, while setting title text you should only use setTitle

Get path to trace out a character in an iOS UIFont

醉酒当歌 提交于 2019-11-27 07:07:58
Suppose I have a custom font "Foo" that I'm using in my iOS App. I've added it to my project, plist, etc. and I'm able to render UILabel s and such with it just fine. Now, if I want to find out a sequence of points that would "trace out" the letter 'P' in that font, how would I get that sequence of points? For example, suppose I wanted to use a CGPath to draw the letter 'P' slowly like a plotter would ... I just need a sequence of CGPoints in an array that if drawn as a path would draw a 'P'. I realize that for some letters like 'T', this may not make sense, since the pen would have to be