SCSArticleViewControllerDelegate

@protocol SCSArticleViewControllerDelegate <NSObject>

Delegate protocol used to interact with article view controllers.

  • Message sent to the delegate when the selected category is changed.

    Declaration

    Objective-C

    - (void)articleController:(nonnull SCSArticleViewController *)controller
            categoryDidChange:(nonnull SCSCategory *)newCategory;

    Swift

    optional func articleController(_ controller: SCSArticleViewController, categoryDidChange newCategory: SCSCategory)

    Parameters

    controller

    The article view controller.

    newCategory

    The new category.

  • Informs the delegate when an article will be shown.

    This message is sent immediately upon setting a new article.

    Warning

    This method may not be called when a user navigates between Smart Link articles, though the articleController:didShowArticle: method will still be invoked in that condition.

    Declaration

    Objective-C

    - (void)articleController:(nonnull SCSArticleViewController *)controller
              willShowArticle:(nullable SCSArticle *)article;

    Swift

    optional func articleController(_ controller: SCSArticleViewController, willShow article: SCSArticle?)

    Parameters

    controller

    The article view controller.

    article

    The article to be displayed, or nil if no article is selected.

  • Informs the delegate when an article has finished being shown.

    This is sent when the article has finished loading and is displayed on the screen. If the view controller isn’t initially presented in the view hierarchy when the article is initially set, this message may be delayed until the controller is eventually presented and the article is loaded.

    Declaration

    Objective-C

    - (void)articleController:(nonnull SCSArticleViewController *)controller
               didShowArticle:(nullable SCSArticle *)article;

    Swift

    optional func articleController(_ controller: SCSArticleViewController, didShow article: SCSArticle?)

    Parameters

    controller

    The article view controller.

    article

    The article being shown, or nil if no article is selected.

  • The target height for the given header view.

    If this method isn’t implemented, the height for the article header will be determined automatically. If a header view isn’t to be used for this article, this method is never called.

    Declaration

    Objective-C

    - (CGFloat)articleController:(nonnull SCSArticleViewController *)controller
             heightForHeaderView:(nonnull UIView *)headerView;

    Swift

    optional func articleController(_ controller: SCSArticleViewController, heightForHeaderView headerView: UIView) -> CGFloat

    Parameters

    controller

    The article view controller.

    headerView

    The header view to be displayed.

    Return Value

    Positive float value for the desired target header view height.

  • Header view to display above the article.

    If this method isn’t implemented, a default header view will be used if an image is available for this article. If you do not wish for a header to be displayed, you can return nil from this method to opt out of displaying a header.

    Auto Layout rules will be applied when adding this view to the hierarchy.

    Declaration

    Objective-C

    - (nullable __kindof UIView *)articleController:
                                      (nonnull SCSArticleViewController *)controller
                               headerViewForArticle:(nonnull SCSArticle *)article;

    Swift

    optional func articleController(_ controller: SCSArticleViewController, headerViewFor article: SCSArticle) -> UIView?

    Parameters

    controller

    The article view controller.

    article

    The article being displayed.

    Return Value

    UIView instance to be used within the header, or nil.

  • Asks the delegate for additional CSS for the given article.

    This can be used to control the additional styling used for an article on a per-article basis. This goes above and beyond the generic CSS available in SCAppearanceConfiguration.globalArticleCSS.

    For more information on the HTML format the CSS may want control over, see the documentation in SCSArticleViewController for more details.

    Declaration

    Objective-C

    - (nullable NSString *)articleController:
                               (nonnull SCSArticleViewController *)controller
                     additionalCSSForArticle:(nonnull SCSArticle *)article;

    Swift

    optional func articleController(_ controller: SCSArticleViewController, additionalCSSFor article: SCSArticle) -> String?

    Parameters

    controller

    The article view controller.

    article

    The article being viewed.

    Return Value

    Valid CSS for rendering the article, or nil if no custom CSS should be used.

  • Asks the delegate for additional javascript for the given article.

    This can be used to control the additional javascript used for an article on a per-article basis. This goes above and beyond the generic Javascript available in SCAppearanceConfiguration.globalArticleJavascript.

    Declaration

    Objective-C

    - (nullable NSString *)articleController:
                               (nonnull SCSArticleViewController *)controller
              additionalJavascriptForArticle:(nonnull SCSArticle *)article;

    Swift

    optional func articleController(_ controller: SCSArticleViewController, additionalJavascriptFor article: SCSArticle) -> String?

    Parameters

    controller

    The article view controller.

    article

    The article being viewed.

    Return Value

    Valid Javascript for customizing the article, or nil if no custom CSS should be used.