iOS Developer Library

Developer

UIKit Framework Reference UIRefreshControl Class Reference

Options
Deployment Target:

On This Page
Language:

UIRefreshControl

Inherits From


Import Statement


Swift

import UIKit

Objective-C

@import UIKit;

Availability


Available in iOS 6.0 and later

A UIRefreshControl object provides a standard control that can be used to initiate the refreshing of a table view’s contents. You link a refresh control to a table through an associated table view controller object. The table view controller handles the work of adding the control to the table’s visual appearance and managing the display of that control in response to appropriate user gestures.

In addition to assigning a refresh control to a table view controller’s refreshControl property, you must configure the target and action of the control itself. The control does not initiate the refresh operation directly. Instead, it sends the UIControlEventValueChanged event when a refresh operation should occur. You must assign an action method to this event and use it to perform whatever actions are needed.

The UITableViewController object that owns a refresh control is also responsible for setting that control’s frame rectangle. Thus, you do not need to manage the size or position of a refresh control directly in your view hierarchy.

For information about basic view behaviors, see View Programming Guide for iOS.

  • Initializes and returns a standard refresh control.

    Declaration

    Swift

    init()

    Objective-C

    - (instancetype)init

    Return Value

    An initialized refresh control.

    Discussion

    The returned refresh control is configured with a default height and width. After you assign the control to a UITableViewController object, the frame of the control is adjusted to match and is managed thereafter.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 6.0 and later

  • tintColor tintColor Property

    The tint color for the refresh control.

    Declaration

    Swift

    var tintColor: UIColor!

    Objective-C

    @property(nonatomic, retain) UIColor *tintColor

    Discussion

    The default value of this property is nil.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 6.0 and later

  • The styled title text to display in the refresh control.

    Declaration

    Swift

    var attributedTitle: NSAttributedString?

    Objective-C

    @property(nonatomic, retain) NSAttributedString *attributedTitle

    Discussion

    The default value of this property is nil.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 6.0 and later

  • Tells the control that a refresh operation was started programmatically.

    Declaration

    Swift

    func beginRefreshing()

    Objective-C

    - (void)beginRefreshing

    Discussion

    Call this method when an external event source triggers a programmatic refresh of your table. For example, if you use an NSTimer object to refresh the contents of the table view periodically, you would call this method as part of your timer handler. This method updates the state of the refresh control to reflect the in-progress refresh operation. When the refresh operation ends, be sure to call the endRefreshing method to return the control to its default state.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 6.0 and later

  • Tells the control that a refresh operation has ended.

    Declaration

    Swift

    func endRefreshing()

    Objective-C

    - (void)endRefreshing

    Discussion

    Call this method at the end of any refresh operation (whether it was initiated programmatically or by the user) to return the refresh control to its default state. If the refresh control is at least partially visible, calling this method also hides it. If animations are also enabled, the control is hidden using an animation.

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 6.0 and later

  • A Boolean value indicating whether a refresh operation has been triggered and is in progress. (read-only)

    Declaration

    Swift

    var refreshing: Bool { get }

    Objective-C

    @property(nonatomic, readonly, getter=isRefreshing) BOOL refreshing

    Import Statement

    Objective-C

    @import UIKit;

    Swift

    import UIKit

    Availability

    Available in iOS 6.0 and later