Skip to content
This repository was archived by the owner on Nov 29, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Source/UIScrollView+EmptyDataSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,18 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (nullable CAAnimation *)imageAnimationForEmptyDataSet:(UIScrollView *)scrollView;

/**
Provides the data source with the means to customize the button that appears
at the bottom of the empty data set. Implementing this method will mean that
any values provided in `-buttonTitleForEmptyDataSet:forState:`,
`-buttonImageForEmptyDataSet:forState:`, and ``buttonBackgroundImageForEmptyDataSet:forState:`
will be ignored.

@param scrollView A scrollView subclass object informing the data source.
@param button The button that will be displayed at the bottom of the empty data set.
*/
- (void)emptyDataSet:(UIScrollView*)scrollView configureButton:(UIButton*)button;

/**
Asks the data source for the title to be used for the specified button state.
The dataset uses a fixed font style by default, if no attributes are set. If you want a different font style, return a attributed string.
Expand Down
7 changes: 5 additions & 2 deletions Source/UIScrollView+EmptyDataSet.m
Original file line number Diff line number Diff line change
Expand Up @@ -505,9 +505,12 @@ - (void)dzn_reloadEmptyDataSet
if (detailLabelString) {
view.detailLabel.attributedText = detailLabelString;
}

// Configure button
if (buttonImage) {
if (self.emptyDataSetSource && [self.emptyDataSetSource respondsToSelector:@selector(emptyDataSet:configureButton:)]) {
[self.emptyDataSetSource emptyDataSet:self configureButton:view.button];
}
else if (buttonImage) {
[view.button setImage:buttonImage forState:UIControlStateNormal];
[view.button setImage:[self dzn_buttonImageForState:UIControlStateHighlighted] forState:UIControlStateHighlighted];
}
Expand Down