Class: UIFont

Inherits:
NSObject show all

Overview

The UIFont class provides the interface for getting and setting font information. The class provides you with access to the font’s characteristics and also provides the system with access to the font’s glyph information, which is used during layout. You use font objects by passing them to methods that accept them as a parameter.

Instance Attribute Summary (collapse)

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from NSObject

#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version

Constructor Details

This class inherits a constructor from NSObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class NSObject

Instance Attribute Details

- (Float) ascender (readonly)

The top y-coordinate, offset from the baseline, of the receiver’s longest ascender. (read-only) The ascender value is measured in points.

Returns:

- (Float) capHeight (readonly)

The receiver’s cap height information. (read-only) This value measures (in points) the height of a capital character.

Returns:

- (Float) descender (readonly)

The bottom y-coordinate, offset from the baseline, of the receiver’s longest descender. (read-only) The descender value is measured in points. This value may be positive or negative. For example, if the longest descender extends 2 points below the baseline, this method returns -2.0 .

Returns:

- (String) familyName (readonly)

The font family name. (read-only) A family name is a name such as Times New Roman that identifies one or more specific fonts. The value in this property is intended for an application’s internal usage only and should not be displayed.

Returns:

- (String) fontName (readonly)

The font face name. (read-only) The font name is a name such as HelveticaBold that incorporates the family name and any specific style information for the font. The value in this property is intended for an application’s internal usage only and should not be displayed.

Returns:

- (Float) lineHeight (readonly)

The height of text lines (measured in points). (read-only)

Returns:

- (Float) pointSize (readonly)

The receiver’s point size, or the effective vertical point size for a font with a nonstandard matrix. (read-only)

Returns:

- (Float) xHeight (readonly)

The x-height of the receiver. (read-only) This value measures (in points) the height of the lowercase character "x".

Returns:

Class Method Details

+ (UIFont) boldSystemFontOfSize(fontSize)

Returns the font object used for standard interface items that are rendered in boldface type in the specified size.

Parameters:

  • fontSize (Float)

    The size (in points) to which the font is scaled. This value must be greater than 0.0.

Returns:

  • (UIFont)

    A font object of the specified size.

+ (Float) buttonFontSize

Returns the standard font size used for buttons.

Returns:

  • (Float)

    The standard button font size in points.

+ (Array) familyNames

Returns an array of font family names available on the system. Font family names correspond to the base name of a font, such as Times New Roman. You can pass the returned strings to the fontNamesForFamilyName: method to retrieve a list of font names available for that family. You can then use the corresponding font name to retrieve an actual font object.

Returns:

  • (Array)

    An array of NSString objects, each of which contains the name of a font family.

+ (Array) fontNamesForFamilyName(familyName)

Returns an array of font names available in a particular font family. You can pass the returned strings as parameters to the fontWithName:size: method to retrieve an actual font object.

Parameters:

  • familyName (String)

    The name of the font family. Use the familyNames method to get an array of the available font family names on the system.

Returns:

  • (Array)

    An array of NSString objects, each of which contains a font name associated with the specified family.

+ (UIFont) fontWithName(fontName, size:fontSize)

Creates and returns a font object for the specified font name and size. You can use the fontNamesForFamilyName: method to retrieve the specific font names for a given font family.

Parameters:

  • fontName (String)

    The fully specified name of the font. This name incorporates both the font family name and the specific style information for the font.

  • fontSize (Float)

    The size (in points) to which the font is scaled. This value must be greater than 0.0.

Returns:

  • (UIFont)

    A font object of the specified name and size.

+ (UIFont) italicSystemFontOfSize(fontSize)

Returns the font object used for standard interface items that are rendered in italic type in the specified size.

Parameters:

  • fontSize (Float)

    The size (in points) to which the font is scaled. This value must be greater than 0.0.

Returns:

  • (UIFont)

    A font object of the specified size.

+ (Float) labelFontSize

Returns the standard font size used for labels.

Returns:

  • (Float)

    The standard label font size in points.

+ (Float) smallSystemFontSize

Returns the size of the standard small system font.

Returns:

  • (Float)

    The standard small system font size in points.

+ (UIFont) systemFontOfSize(fontSize)

Returns the font object used for standard interface items in the specified size.

Parameters:

  • fontSize (Float)

    The size (in points) to which the font is scaled. This value must be greater than 0.0.

Returns:

  • (UIFont)

    A font object of the specified size.

+ (Float) systemFontSize

Returns the size of the standard system font.

Returns:

  • (Float)

    The standard system font size in points.

Instance Method Details

- (UIFont) fontWithSize(fontSize)

Returns a font object that is the same as the receiver but which has the specified size instead.

Parameters:

  • fontSize (Float)

    The desired size (in points) of the new font object. This value must be greater than 0.0.

Returns:

  • (UIFont)

    A font object of the specified size.