UIRefreshControl Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/UIKit.framework
Availability
Available in iOS 6.0 and later.
Declared in
UIRefreshControl.h

Overview

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.

Tasks

Initializing a Refresh Control

Accessing the Control Attributes

Managing the Refresh Status

Properties

attributedTitle

The styled title text to display in the refresh control.

@property (nonatomic, retain) NSAttributedString *attributedTitle
Discussion

The default value of this property is nil.

Availability
  • Available in iOS 6.0 and later.
Declared In
UIRefreshControl.h

refreshing

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

@property (nonatomic, readonly, getter=isRefreshing) BOOL refreshing
Availability
  • Available in iOS 6.0 and later.
Declared In
UIRefreshControl.h

tintColor

The tint color for the refresh control.

@property (nonatomic, retain) UIColor *tintColor
Discussion

The default value of this property is nil.

Availability
  • Available in iOS 6.0 and later.
Declared In
UIRefreshControl.h

Instance Methods

beginRefreshing

Tells the control that a refresh operation was started programmatically.

- (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.

Availability
  • Available in iOS 6.0 and later.
Declared In
UIRefreshControl.h

endRefreshing

Tells the control that a refresh operation has ended.

- (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.

Availability
  • Available in iOS 6.0 and later.
Declared In
UIRefreshControl.h

init

Initializes and returns a standard refresh control.

- (id)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.

Availability
  • Available in iOS 6.0 and later.
Declared In
UIRefreshControl.h