UITableViewHeaderFooterView
The UITableViewHeaderFooterView class implements a reusable view that can be placed at the top or bottom of a table section. You use headers and footers to display additional information for that section.
More...
Inheritance
-
NSObject -
UIResponder -
UIView -
UITableViewHeaderFooterView
-
NSObject -
UIResponder -
UIView -
UITableViewHeaderFooterView
Conforms To
Import Statement
import UIKit
@import UIKit;
Availability
Available in iOS 6.0 and later.
-
Initializes a header/footer view with the specified reuse identifier.
Declaration
Swift
init(reuseIdentifierreuseIdentifier: String?)Objective-C
- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifierParameters
reuseIdentifierA string used to identify the header or footer view if it is to be reused by multiple sections. Pass
nilif the view is not to be reused. You should use the same reuse identifier for all header or footer views of the same form.Return Value
An initialized
UITableViewHeaderFooterViewobject ornilif the object could not be created.Discussion
Once set, you cannot change the reuse identifier for the returned view object.
Import Statement
import UIKitAvailability
Available in iOS 6.0 and later.
-
The content view of the header or footer. (read-only)
Declaration
Swift
var contentView: UIView { get }Objective-C
@property(nonatomic, readonly, retain) UIView *contentViewDiscussion
To create your header or footer content, you add subviews to the view in this property. Your custom subviews represent the main content of your header or footer. It is your responsibility to configure all subviews.
Import Statement
import UIKitAvailability
Available in iOS 6.0 and later.
-
The background view of the header or footer.
Declaration
Swift
var backgroundView: UIView?Objective-C
@property(nonatomic, retain) UIView *backgroundViewDiscussion
The view in this property is placed behind the view in the
contentViewproperty and used to display static background content behind the header or footer. For example, you might assign an image view to this property and use it to display a custom background image.Import Statement
import UIKitAvailability
Available in iOS 6.0 and later.
-
A string used to identify a reusable header or footer. (read-only)
Declaration
Swift
var reuseIdentifier: String? { get }Objective-C
@property(nonatomic, readonly, copy) NSString *reuseIdentifierDiscussion
You assign a reuse identifier to a header or footer view at creation time. Once assigned, the table view uses that reuse identifier to gather your views when they are scrolled offscreen and queue them for later reuse. You can retrieve header or footer views by passing the same reuse identifier to the
dequeueReusableHeaderFooterViewWithIdentifier:method of the table view.Import Statement
import UIKitAvailability
Available in iOS 6.0 and later.
-
Prepares a reusable header or footer view for reuse by the table.
Declaration
Swift
func prepareForReuse()Objective-C
- (void)prepareForReuseDiscussion
If your header or footer view is reusable—that is, it has a reuse identifier—the table view calls this method just before returning the view from its
dequeueReusableHeaderFooterViewWithIdentifier:method. Subclasses can override this method and use it to reset attributes of the view to their default values. For performance reasons, you should only reset attributes that are not related to content.If the view does not have a reuse identifier, this method is never called.
Import Statement
import UIKitAvailability
Available in iOS 6.0 and later.
-
A primary text label for the view. (read-only)
Declaration
Swift
var textLabel: UILabel { get }Objective-C
@property(nonatomic, readonly, retain) UILabel *textLabelDiscussion
Accessing the value in this property causes the view to create a default label for displaying a detail text string. If you are managing the content of the view yourself by adding subviews to the
contentViewproperty, you should not access this property.The label is sized to fit the content view area in the best way possible based on the size of the string. Its size is also adjusted depending on whether there is a detail text label present.
Import Statement
import UIKitAvailability
Available in iOS 6.0 and later.
-
A detail text label for the view. (read-only)
Declaration
Swift
var detailTextLabel: UILabel! { get }Objective-C
@property(nonatomic, readonly, retain) UILabel *detailTextLabelDiscussion
This property is only used for tables configured with
UITableViewStyleGrouped.Accessing the value in this property causes the view to create a default label for displaying a detail text string. If you are managing the content of the view yourself by adding subviews to the
contentViewproperty, you should not access this property.The label is sized to fit the content view area in the best way possible based on the size of the string. Its size is also adjusted depending on whether there is a primary text label present.
Import Statement
import UIKitAvailability
Available in iOS 6.0 and later.
Copyright © 2014 Apple Inc. All rights reserved. Terms of Use | Privacy Policy | Updated: 2013-09-18
