SCSArticleViewController Class Reference
Inherits from | UIViewController |
---|---|
Declared in | SCSArticleViewController.h |
Overview
View controller capable of displaying the contents of an article. When used in
conjunction with a navigation controller, the title
property of the view will
automatically be set to the title of the article, or nil
if no article is assigned.
Article content is automatically rendered into content capable of being displayed within this view controller. The articles data is laid out as HTML and rendered within a WKWebView instance.
HTML content is rendered using a structure like the following:
<html>
<head>
<meta name="viewport" content="initial-scale=1"/>
<link rel="stylesheet" href="/style.css" type="text/css" media="all"/>
<link rel="stylesheet" href="/article/{{article.id}}/style.css" type="text/css" media="all"/>
</head>
<body>
<header>
{{article.title}}
</header>
<main>
<field name="{{field.name}}" type="{{field.type}}">
<field-title>{{field.title}}</field-title>
<field-value>{{field.value}}</field-value>
</field>
</main>
<script src="/script.js"></script>
<script src="/article/{{article.id}}/script.js"></script>
</body>
</html>
Each article field is separated into its own block which can be independently formatted, hidden, or otherwise styled using custom CSS. The default global CSS is automatically populated based on the fonts and colors defined in SCAppearanceConfiguration
. Furthermore, if any custom styles need to be changed, SCAppearanceConfiguration
.globalArticleCSS
property can be used to add default syles that are applied to all articles. Likewise, the SCAppearanceConfiguration
.globalArticleJavascript
property can be used to supply common javascript to be injected to all articles when they’re loaded.
The [SCSArticleViewControllerDelegate articleController:additionalCSSForArticle:]
and [SCSArticleViewControllerDelegate articleController:additionalJavascriptForArticle:]
delegate methods can be used to provide more granular perarticle control over both CSS and javascript.
category
The category information to use when displaying empty content. If nil
is assigned, the value
will automatically reset to the root data category.
@property (null_resettable, nonatomic, strong) SCSCategory *category
Declared In
SCSArticleViewController.h
article
The article to display. If the article is not yet cached, its content will automatically
be downloaded on-demand when the view is loaded. If nil
is assigned, an empty view will
automatically be shown to display information about the data category.
@property (nullable, nonatomic, copy) SCSArticle *article
Declared In
SCSArticleViewController.h