SCSCategoryViewControllerDelegate
@protocol SCSCategoryViewControllerDelegate <NSObject>
Delegate protocol to allow the receiver to interact with, and control the experience of, a category view controller.
-
Informs the delegate when a category is assigned and it begins to load.
Declaration
Objective-C
- (void)categoryController:(nonnull SCSCategoryViewController *)controller willLoadCategory:(nonnull SCSCategory *)category;
Swift
optional func categoryController(_ controller: SCSCategoryViewController, willLoad category: SCSCategory)
Parameters
controller
The SCSCategoryViewController instance.
category
The category that was assigned to the controller.
-
Informs the delegate when a category is assigned and it completes loading.
Declaration
Objective-C
- (void)categoryController:(nonnull SCSCategoryViewController *)controller didLoadCategory:(nonnull SCSCategory *)category;
Swift
optional func categoryController(_ controller: SCSCategoryViewController, didLoad category: SCSCategory)
Parameters
controller
The SCSCategoryViewController instance.
category
The category that was assigned to the controller.
-
Informs the delegate when a category is selected.
Declaration
Objective-C
- (BOOL)categoryController:(nonnull SCSCategoryViewController *)controller childCategorySelected:(nonnull SCSCategory *)category;
Swift
optional func categoryController(_ controller: SCSCategoryViewController, childCategorySelected category: SCSCategory) -> Bool
Parameters
controller
The SCSCategoryViewController instance.
category
The category that was selected.
Return Value
YES
if the built-in default action should be performed, otherwiseNO
if no action should be performed. -
Informs the delegate when an article is selected.
Declaration
Objective-C
- (BOOL)categoryController:(nonnull SCSCategoryViewController *)controller articleSelected:(nonnull SCSArticle *)article;
Swift
optional func categoryController(_ controller: SCSCategoryViewController, articleSelected article: SCSArticle) -> Bool
Parameters
controller
The SCSCategoryViewController instance.
article
The article that was selected.
Return Value
YES
if the built-in default action should be performed, otherwiseNO
if no action should be performed. -
Informs the delegate when the “Show More Articles” row is tapped.
This is only supported on controllers that have child categories, and whose display mode is
SCSCategoryDisplayModeArticlesAndCategories
.Declaration
Objective-C
- (BOOL)categoryController:(nonnull SCSCategoryViewController *)controller showMoreArticlesSelectedForCategory:(nonnull SCSCategory *)category;
Swift
optional func categoryController(_ controller: SCSCategoryViewController, showMoreArticlesSelectedFor category: SCSCategory) -> Bool
Parameters
controller
The SCSCategoryViewController instance.
category
The category being shown.
Return Value
YES
if the built-in default action should be performed, otherwiseNO
if no action should be performed. -
Allows the delegate to customize the header view used for the indicated type.
If
nil
is returned, then no header will be used for that section.If you want to use the default header view, don’t implement this method.
The
SCSCategoryHeaderTypeChildCategories
header type is only requested of the delegate when the selected category has child categories, and when the display mode isSCSCategoryDisplayModeArticlesAndCategories
.Declaration
Objective-C
- (nullable __kindof UIView *) categoryController:(nonnull SCSCategoryViewController *)controller headerViewForType:(SCSCategoryHeaderType)headerType forCategory:(nonnull SCSCategory *)category;
Swift
optional func categoryController(_ controller: SCSCategoryViewController, headerViewFor headerType: SCSCategoryHeaderType, for category: SCSCategory) -> UIView?
Parameters
controller
The SCSCategoryViewController instance.
headerType
The type of header view being requested.
category
The category being shown.
Return Value
A UIView to show in the header section of the given type, or
nil
if no header should be shown. -
Allows the delegate to customize the height of the header view used for the indicated type.
If you want to use the default height, don’t implement this method.
Declaration
Objective-C
- (CGFloat)categoryController:(nonnull SCSCategoryViewController *)controller heightForHeaderType:(SCSCategoryHeaderType)headerType forCategory:(nonnull SCSCategory *)category;
Swift
optional func categoryController(_ controller: SCSCategoryViewController, heightFor headerType: SCSCategoryHeaderType, for category: SCSCategory) -> CGFloat
Parameters
controller
The SCSCategoryViewController instance.
headerType
The type of header view being requested.
category
The category being shown.
Return Value
The desired height of the header.