iOS Developer Library — Prerelease

Developer

UIKit Framework Reference UIKit Data Types Reference

Options
Deployment Target:

On This Page
Language:

UIKit Data Types Reference

The UIKit framework defines data types that are used in multiple places throughout the framework.

Data Types

  • Defines the stylistic appearance of different types of views.

    Declaration

    Swift

    enum UIBarStyle : Int { case Default case Black static var BlackOpaque: UIBarStyle { get } case BlackTranslucent }

    Objective-C

    typedef enum { UIBarStyleDefault = 0, UIBarStyleBlack = 1, UIBarStyleBlackOpaque = 1, // Deprecated UIBarStyleBlackTranslucent = 2, // Deprecated } UIBarStyle;

    Constants

    • Default

      UIBarStyleDefault

      Use the default style normally associated with the given view. For example, navigation bars typically use a white background with dark content.

      Available in iOS 2.0 and later.

    • Black

      UIBarStyleBlack

      Use a black background with light content.

      Available in iOS 3.0 and later.

    • BlackOpaque

      UIBarStyleBlackOpaque

      Deprecated. Use UIBarStyleBlack instead.

      Available in iOS 2.0 and later.

    • BlackTranslucent

      UIBarStyleBlackTranslucent

      Deprecated. Use UIBarStyleBlack and set the translucent property to YEStrue instead.

      Available in iOS 2.0 and later.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 2.0 and later.

  • Defines the types of information that can be detected in text-based content.

    Declaration

    Swift

    struct UIDataDetectorTypes : OptionSetType { init(rawValue rawValue: UInt) static var PhoneNumber: UIDataDetectorTypes { get } static var Link: UIDataDetectorTypes { get } static var Address: UIDataDetectorTypes { get } static var CalendarEvent: UIDataDetectorTypes { get } static var None: UIDataDetectorTypes { get } static var All: UIDataDetectorTypes { get } }

    Objective-C

    enum { UIDataDetectorTypePhoneNumber = 1 << 0, UIDataDetectorTypeLink = 1 << 1, UIDataDetectorTypeAddress = 1 << 2, UIDataDetectorTypeCalendarEvent = 1 << 3, UIDataDetectorTypeNone = 0, UIDataDetectorTypeAll = NSUIntegerMax }; typedef NSUInteger UIDataDetectorTypes;

    Constants

    • PhoneNumber

      UIDataDetectorTypePhoneNumber

      Detect strings formatted as phone numbers.

      Available in iOS 3.0 and later.

    • Link

      UIDataDetectorTypeLink

      Detect strings formatted as URLs.

      Available in iOS 3.0 and later.

    • Address

      UIDataDetectorTypeAddress

      Detect strings formatted as addresses.

      Available in iOS 4.0 and later.

    • CalendarEvent

      UIDataDetectorTypeCalendarEvent

      Detect strings formatted as calendar events.

      Available in iOS 4.0 and later.

    • None

      UIDataDetectorTypeNone

      Do no data detection.

      Available in iOS 3.0 and later.

    • All

      UIDataDetectorTypeAll

      Detect all available types of data.

      Available in iOS 3.0 and later.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 3.0 and later.

  • Defines inset distances for views.

    Declaration

    Swift

    struct UIEdgeInsets { var top: CGFloat var left: CGFloat var bottom: CGFloat var right: CGFloat init() init(top top: CGFloat, left left: CGFloat, bottom bottom: CGFloat, right right: CGFloat) }

    Objective-C

    typedef struct { CGFloat top, left , bottom, right ; } UIEdgeInsets;

    Discussion

    Edge inset values are applied to a rectangle to shrink or expand the area represented by that rectangle. Typically, edge insets are used during view layout to modify the view’s frame. Positive values cause the frame to be inset (or shrunk) by the specified amount. Negative values cause the frame to be outset (or expanded) by the specified amount.

    See also UIEdgeInsetsMake and UIEdgeInsetsZero.

    Availability

    Available in iOS 2.0 and later.

  • Defines a structure that specifies an amount to offset a position.

    Declaration

    Swift

    struct UIOffset { var horizontal: CGFloat var vertical: CGFloat init() init(horizontal horizontal: CGFloat, vertical vertical: CGFloat) }

    Objective-C

    typedef struct UIOffset { CGFloat horizontal, vertical } UIOffset;

    Discussion

    The components are positive for right or down, negative for left or up.

    See also UIOffsetMake and UIOffsetZero.

    Availability

    Available in iOS 5.0 and later.

  • Defines the size class of a view.

    Declaration

    Swift

    enum UIUserInterfaceSizeClass : Int { case Unspecified case Compact case Regular }

    Objective-C

    typedef NS_ENUM (NSInteger, UIUserInterfaceSizeClass { UIUserInterfaceSizeClassUnspecified = 0, UIUserInterfaceSizeClassCompact = 1, UIUserInterfaceSizeClassRegular = 2, };

    Constants

    • Unspecified

      UIUserInterfaceSizeClassUnspecified

      Indicates the size class has not been specified.

      Available in iOS 8.0 and later.

    • Compact

      UIUserInterfaceSizeClassCompact

      Indicates a compact size class.

      Available in iOS 8.0 and later.

    • Regular

      UIUserInterfaceSizeClassRegular

      Indicates a regular size class.

      Available in iOS 8.0 and later.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 8.0 and later.