objective-c,ios7,uikit,uifont,uifontdescriptor
Initially, I counted 4 open brackets and 3 close brackets, which will cause an error. Additionally, fontWithDescriptor: should be fontWithDescriptor:size:, which is probably the expected expression. Finally, using fontWithDescriptor:size: to define a font, then asking for its descriptor is redundant, so a cleaner version of the command is this: UIFontDescriptor...
Since you're adding your own personal functionality to a Type, I think you should use an extension, declare this extension outside of your class: extension UIFont { // You can set a default value for the size if the user doesn't provide one. class func defaultFont(size: CGFloat = 12) ->...
In the documentation: fontSize The size (in points) to which the font is scaled. This value must be greater than 0.0. You are trying to implement behaviour which is not supported. An 'incorrect' result is to be expected....
ios,uilabel,uifont,cgrect,cgsize
So basically you want to calculate height of text when you know text width. CGRect rect = [str boundingRectWithSize:CGSizeMake(cellWidth, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin context:nil]; Use resulting rect.size the way you want....
A label adds a little margin round the outside of the text, and you have not allowed for that. If, instead, you use a custom UIView exactly the size of the string rect, you will see that the text fits perfectly: Here's the code I used. In the view controller:...
UIFont.fontNamesForFamilyName(familyNames.objectAtIndex(indFamily)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ objectAtIndex, being a Objective-C method that returns id, returns a AnyObject instance in Swift, not a String. You could "cast" that to String. fontNames = NSArray(array: UIFont.fontNamesForFamilyName( familyNames.objectAtIndex(indFamily) as String)) This is how a version with more Swift and less Objective-C would look like: class func listAllFontsOnSystem2(){ let...
ios,uilabel,uifont,monospace,ios9
What about: let originalFont = UIFont.systemFontOfSize(17) let originalFontDescriptor = originalFont.fontDescriptor() let fontDescriptorFeatureSettings = [ [ UIFontFeatureTypeIdentifierKey: kNumberSpacingType, UIFontFeatureSelectorIdentifierKey: kMonospacedNumbersSelector ] ] let fontDescriptorAttributes = [UIFontDescriptorFeatureSettingsAttribute: fontDescriptorFeatureSettings] let fontDescriptor = originalFontDescriptor.fontDescriptorByAddingAttributes(fontDescriptorAttributes) let font = UIFont(descriptor: fontDescriptor,...
I have decided to simply create a dummy label, set it's text property and set numberOfLines to 0 and say [label sizeToFit] that will allow you to get the frame of the label, which includes the height. It's not an ideal way, but it works. Apparently in iOS 8 there...
ios,ios6,xcode5,uitextview,uifont
I finally fixed this problem by recreating my attributedtext again and setting it as a new attributedtext to my uitextview.
Usually it's done by defining behavior for each specific device. You can find out the device type in runtime: https://gist.github.com/Jaybles/1323251 Example code: UIDeviceHardware *h=[[UIDeviceHardware alloc] init]; if ( [h platformString] isEqualToString:@"iPhone4"] ) { // don't use blur } As for which devices support blur, you can use code from here:...
uitableview,swift,xcode6,uifont,textlabel
You're using the regular font name. To use the bold variation of the font, use this code: cell.textLabel?.font = UIFont(name: "SnellRoundhand-Bold", size: 40) ...
museoSansRounded900 should be a class method as you're trying to call it directly on the UIFont class (which makes it basically a constructor). class func museoSansRounded900(size: CGFloat) -> UIFont ... ...
swift,fonts,styles,size,uifont
You can do it like. textView.font = UIFont(name: textView.font.fontName, size: 18) Here the font should be as same you defined but you can change the size as you want. If you want to fix the size then and change the name of font then you can use textView.font.pointSize...
ios,objective-c,uifont,custom-font
You inadvertently added them to the wrong (Test) Info.plist.
HelveticaNeue-Bold is the identifier. Here is a snippet of code you can use to list all the available fonts: NSArray *familyNames = [[NSArray alloc]initWithArray:[UIFont familyNames]]; for (NSString *familyName in familyNames) { NSLog(@"%@", familyName); NSArray *fontNames = [UIFont fontNamesForFamilyName:familyName]; for (NSString *fontName in fontNames) { NSLog(@"\t%@", fontName); } } ...
ios,uifont,watchkit,apple-watch
Yes, you can use custom fonts in WatchKit https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/WatchKitProgrammingGuide/TextandLabels.html...
ios,core-text,uifont,typography
The slight difference is probably due to some fractional offset of the text itself. The pixels in the two characters look very close to the same, but with different amounts of grey or black. Try placing your Helvetica Neue Ultra Light text 0.5 pixels left or right and 0.5 up...
swift,uitableview,fonts,uifont,custom-cell
You can applied bold font on alternative cell like as bellowed way. func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let couCell = tableView.dequeueReusableCellWithIdentifier(textCellIdentifier, forIndexPath: indexPath) as UITableViewCell let row = indexPath.row if row == 2 || row == 4 || row == 6 { couCell?.textLabel?.font = UIFont(name: "Helvetica-BoldOblique",...
ios,objective-c,fonts,uifont,emoji
I finally solve it : - (BOOL)isCharacter:(unichar)character supportedByFont:(UIFont *)aFont { UniChar characters[] = { character }; CGGlyph glyphs[1] = { }; CTFontRef ctFont = CTFontCreateWithName((CFStringRef)aFont.fontName, aFont.pointSize, NULL); BOOL ret = CTFontGetGlyphsForCharacters(ctFont, characters, glyphs, 1); CFRelease(ctFont); return ret; } ...
ios,objective-c,uilabel,true-type-fonts,uifont
I'm assuming that you have verified the font is loaded and set onto the label. If not you need to log all of the fonts loaded in the system, check it's there and find the correct font name to pass to UIFont. You need to set the label text to...
[UIFont fontWithName:@"HelveticaNeue-Thin" size:14.0]; Your font name is incorrect....