uifont

iPhone - Strike out an NSString [duplicate]

独自空忆成欢 提交于 2019-12-08 04:02:01
问题 This question already has answers here : Best way to strike out a text (2 answers) Closed 6 years ago . I would like to know if there is an easy way to strike/cross out some text on the iPhone? Thanks 回答1: Yes and No, NSString is a simple class, that only stores unformated text, but you can use an NSAttributedString to store such information, i.e. NSAttributedString* italicText = [[NSAttributedString alloc] initWithString:myNsString attributes:myCrossOutAttributes]; 回答2:

How to use alternate font weights (e.g. “short”) in a WKInterfaceLabel?

大憨熊 提交于 2019-12-08 03:59:44
问题 In Apple's Apple Watch Design Resources, there is a document called Alternate Font Weights and Italicizations . In it, it shows examples of what the default font looks like with different attributes such as Italic , Emphasized , and Short applied to it. Assume I want to use a font that looks exactly like the "Short" example. Is there any way to choose this font and style via the storyboard for a label? In code, how would I set a label to use this font and style? 回答1: In an iOS project, I

Using the fontWithSize API with San Francisco

二次信任 提交于 2019-12-08 03:08:09
问题 The new San Francisco fonts in iOS 9 are optimized for the size it will be used at, by adjusting tracking and dynamically switching between SF Display and SF Text. It was noted in the WWDC session #804 developers should not use San Francisco by attempting to initialize a UIFont using fontWithName , for example: UIFont *originalFont = [UIFont systemFontOfSize:11]; UIFont *newFont = [UIFont fontWithName:originalFont.fontName size:44]; This is because the system cannot optimize the font for the

UILabel's font not adjusting until view reappears

牧云@^-^@ 提交于 2019-12-08 02:04:26
问题 Using the storyboard I created a tableview with cells that have labels. I want to be able to easily assign the same font to all labels in my app so I created some fonts in a helper file (smallFont, mediumFont, and largeFont) and in tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) I set each label to use the font I want (i.e. cell.label.font = Common.fonts.mediumFont). The first time the tableview displays it is using the font defined in the storyboard and it

Custom arabic font working in iOS 7 but not in iOS 6 or earlier

☆樱花仙子☆ 提交于 2019-12-07 19:16:46
问题 I have an iPhone app where I am using custom arabic font. All is working in iOS 7. When I run the app on iOS 6, the text is appearing in default iPhone font. Any idea what is going wrong? iOS 6 Screenshot iOS 7 Screenshot If you see the difference, english is working fine. ONLY PROBLEM WITH ARABIC FONT. 回答1: Problem solved... UILabel *arTitle = [[UILabel alloc] initWithFrame:CGRectMake(0, 200, 300, 100)]; arTitle.backgroundColor = [UIColor clearColor]; arTitle.textColor = [UIColor blueColor];

UIFont custom font not displaying on device

不打扰是莪最后的温柔 提交于 2019-12-07 14:01:31
问题 I have a problem with custom font. Namely it's Tw Cen MT.ttf It's the same problem as in here: Custom font not showing on device, but does on simulator Except the given solution doesn't work for me. I have done exactly what you should do: Added Font to Info.plist Added Font to Copy Bundle Resources section in Build Phases. Used font programmatically by name not filename. It still doesn't work. What's more interesting - when I list available fonts: NSLog(@"%@", [UIFont familyNames]); It shows

Dynamically Mocking iOS Dynamic Type System Text Size (UIContentSizeCategory)

杀马特。学长 韩版系。学妹 提交于 2019-12-06 17:52:25
问题 I'd like to easily test my app with different selections of system text size, including accessibility sizes. These can be set in the Settings app (Display & Brightness => Text Size or General => Accessibility => Larger Text). The only way I can find to currently do this is to go into Settings and change the value with the UI (edit: partial solution described below). This is slow and cumbersome. I suspect there's a way to dynamically alter it using private APIs, but I can't figure out how.

NSAttributedString change style to bold without changing pointSize?

こ雲淡風輕ζ 提交于 2019-12-06 17:18:25
问题 I am digging into NSAttributedString s on iOS. I have a model that is returning a persons first and last name as NSAttributesString . (I don't know if it is a good idea to deal with attributed strings in models!?) I want the first name to be printed regular where as the last name should be printed in bold. What I don't want is to set a text size. All I found so far is this: - (NSAttributedString*)attributedName { NSMutableAttributedString* name = [[NSMutableAttributedString alloc]

UILabel Dynamic Font size keep breaking

亡梦爱人 提交于 2019-12-06 15:54:57
I Have CollectionViewCell that has only UILabel(Same bounds as cell). I'm fetching array of fontNames as the CollectionView DataSource : func printFonts() { let fontFamilyNames = UIFont.familyNames() for familyName in fontFamilyNames { let names = UIFont.fontNamesForFamilyName(familyName as! String) fontNames.append(familyName as! String) } } I'm trying to display this font names in one line inside the UILabel , it works in some of the cases but in some not, and i have not idea why. this is how i "adjust" the font inside cellForItemAtIndexPath : cell.lbl_font.adjustsFontSizeToFitWidth = true

Font not loading in XCode

…衆ロ難τιáo~ 提交于 2019-12-06 15:02:56
问题 Well, I want to import a new Font to my application but without success. I have the Fonts provided by application key in my .plist , I have my font in the Item 0 as a String and the value AdelleBasic_Bold.otf, I have added that Font to my project, and I am trying to use it with: _myTextField.font = [UIFont fontWithName:@"Adelle Basic" size:15]; Adelle Basic is the header of the Font when I open it. I have also tried without any success: _myTextField.font = [UIFont fontWithName:@"AdelleBasic