uifont

How to detect Dynamic Font size changes from iOS Settings?

别说谁变了你拦得住时间么 提交于 2019-12-03 04:17:56
Inside settings->general->text size, after changing the text size, I'd have to exit my own app to have the sizes applied to [UIFont preferredFontForTextStyle:..] Is there a delegate or notification to notify my app to re-apply the new sizes? Update: I tried the following but interestingly, the font size will apply after I BG and launch the app TWICE. - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(fromBg:) name:UIApplicationDidBecomeActiveNotification

Replace the deprecation sizeWithFont:minFontSIze:actualFontSize in ios 7

寵の児 提交于 2019-12-03 03:27:59
In iOS 6 i was using this method: [self.handText sizeWithFont:font minFontSize:10.0f actualFontSize:&maxFontSize forWidth:handWidth/2 lineBreakMode:UILineBreakModeClip]; xcode 5 says that 'sizeWithFont:minFontSIze:actualFontSize:forWidth:lineBreakMode:' is deprecated:first deprecated in iOS 7 Now i implemented like this: [self.handText sizeWithAttributes:@{NSFontAttributeName:font} minFontSize:10.0f actualFontSize:&maxFontSize forWidth:handWidth/2 lineBreakMode:NSLineBreakByClipping]; here xcode throws another warning saying: 'Instance method -sizeWithAttributed:minFontSize:forWidth

UILabel font : bold and italic [duplicate]

谁说我不能喝 提交于 2019-12-03 03:19:01
This question already has answers here : How do I set bold and italic on UILabel of iPhone/iPad? (19 answers) Possible Duplicate: How do I set bold and italic on UILabel of iPhone/iPad? I am trying to make UILabel font bold and italic both using system font, but I cant use these both style at a time. so is it possible to make font bold and italic using system font? here is my code, lblTitle.font = [UIFont italicSystemFontOfSize:[UIFont systemFontSize]]; or lblTitle.font = [UIFont boldSystemFontOfSize:[UIFont systemFontSize]]; I want my font Bold and Italic both. Can anyone help me? Thank you

Setting BOLD font on iOS UILabel

∥☆過路亽.° 提交于 2019-12-03 02:36:41
问题 I have assigned a custom font of 'Helvetica' with size 14 already for the text in UILabel using Interface Builder. I am using reusing the same label at multiple places, but at some place I have to display the text in bold. Is there any way I can just specify to make the existing font bold instead of creating the whole UIFont again? This is what I do now: myLabel.font = [UIFont fontWithName:@"Helvetica Neue" size:14]; 回答1: UPDATE: Starting with iOS 8, messing with font names is no longer

“Swanky and Moo Moo” font is not working in ios

纵饮孤独 提交于 2019-12-02 19:34:45
问题 I am using "Swanky and Moo Moo" in my application, but it displays the font style as like of system font.. Here my code.... myLabel.font=[UIFont fontWithName:@"Swanky and Moo Moo" size:16]; I have refer the following links.. iOS: How can i set a non system font family, style, size of UILabel? http://kgriff.posterous.com/45359635 But thats are not useful for me....... Can antone tell me that how to set the myLabel font style as Swanky and Moo Moo ?? 回答1: Add your custom font files into your

UIFont Woes (some custom fonts loading, but other's are not)

我怕爱的太早我们不能终老 提交于 2019-12-02 19:19:24
问题 I'm having an issue getting certain custom fonts to load. I followed the advice in the traditional, 400+ upvoted answer to this question, and it worked for one project perfectly. However, in a different project I am working on I have run into issues with loading a UIFont. These issues are somewhat similar to the issues found in the post Adding multiple fonts to UIAppFonts overrides each other. The solution there was that there were issues with the p-list properly parsing out the names into

Setting BOLD font on iOS UILabel

痞子三分冷 提交于 2019-12-02 16:06:05
I have assigned a custom font of 'Helvetica' with size 14 already for the text in UILabel using Interface Builder. I am using reusing the same label at multiple places, but at some place I have to display the text in bold. Is there any way I can just specify to make the existing font bold instead of creating the whole UIFont again? This is what I do now: myLabel.font = [UIFont fontWithName:@"Helvetica Neue" size:14]; LE SANG UPDATE: Starting with iOS 8, messing with font names is no longer needed. Instead see newer answers that use UIFontDescriptorSymbolicTraits : here and here . myLabel.font

UIFont Woes (some custom fonts loading, but other's are not)

喜夏-厌秋 提交于 2019-12-02 12:31:44
I'm having an issue getting certain custom fonts to load. I followed the advice in the traditional, 400+ upvoted answer to this question, and it worked for one project perfectly. However, in a different project I am working on I have run into issues with loading a UIFont. These issues are somewhat similar to the issues found in the post Adding multiple fonts to UIAppFonts overrides each other . The solution there was that there were issues with the p-list properly parsing out the names into XML leading to overwriting. I have attempted to test that hypothesis of the issue: I listed the fonts in

Adding a UIFont and looking for the fontfamily crashes with EXC_BAD_ACCESS

為{幸葍}努か 提交于 2019-12-02 12:17:07
My problem is, that when I add a font which is described here and when I want to retrieve the font family names with [UIFont familyNames] it crashes. I did it the same way described in the example, but for me it doesn't work. This is my stack trace: 0x314b9ebe in CFDictionaryGetValue 0x33d79be4 in copy_localized_value 0x33d79bd4 in CGFontNameTableCopyRootName 0x33d796f2 in CGFontNameTableCreate 0x33d79e86 in CGFontCopyFamilyName 0x3414ca00 in AddFontsFromCGFontAndPath 0x3414cb7e in AddFontsFromURLOrPath 0x3414cc98 in Initialize 0x3414ce0a in GSFontCopyFamilyNames 0x323fce84 in +[UIFont

Toggle selectedRange attributes in UITextView

断了今生、忘了曾经 提交于 2019-12-02 11:01:50
I have created a button that I want to check if text is selected then if so toggle bold and unbold over the selectedRange when tapped. At the moment my code will just change the selectedRange to bold and I can't undo it or check if there is a selection. How can I achieve this? func bold() { if let textRange = selectedRange { let attributes = [NSAttributedString.Key.font: UIFont.systemFont(ofSize: 17, weight: UIFont.Weight.bold)] noteContents.textStorage.addAttributes(attributes as [NSAttributedString.Key : Any], range: textRange) } This might do the trick: func toggleBold() { if let textRange