mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-25 09:11:13 +01:00
Create the WKWebView instance at runtime.
Specify a container view in the storyboard and create+install the web view at viewDidLoad time. This lets us experiment with solutions for providing a web view that avoids the flash-to-white problem.
This commit is contained in:
parent
e5782ca464
commit
a5b2c759ec
@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14854.2" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14865.1" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||||
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14806.4"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14819.2"/>
|
||||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
@ -15,22 +15,13 @@
|
|||||||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<wkWebView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="t8d-md-Yhc">
|
<view contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="DNb-lt-KzC">
|
||||||
<rect key="frame" x="0.0" y="44" width="414" height="769"/>
|
<rect key="frame" x="0.0" y="44" width="414" height="769"/>
|
||||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||||
<wkWebViewConfiguration key="configuration">
|
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
|
||||||
<audiovisualMediaTypes key="mediaTypesRequiringUserActionForPlayback" none="YES"/>
|
</view>
|
||||||
<wkPreferences key="preferences"/>
|
|
||||||
</wkWebViewConfiguration>
|
|
||||||
</wkWebView>
|
|
||||||
</subviews>
|
</subviews>
|
||||||
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
|
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
|
||||||
<constraints>
|
|
||||||
<constraint firstItem="t8d-md-Yhc" firstAttribute="top" secondItem="VUw-jc-0yf" secondAttribute="top" id="0aK-ew-1HG"/>
|
|
||||||
<constraint firstItem="VUw-jc-0yf" firstAttribute="trailing" secondItem="t8d-md-Yhc" secondAttribute="trailing" id="31v-r8-kzh"/>
|
|
||||||
<constraint firstItem="VUw-jc-0yf" firstAttribute="bottom" secondItem="t8d-md-Yhc" secondAttribute="bottom" id="kK6-eC-XwD"/>
|
|
||||||
<constraint firstItem="t8d-md-Yhc" firstAttribute="leading" secondItem="VUw-jc-0yf" secondAttribute="leading" id="nDG-aV-vqc"/>
|
|
||||||
</constraints>
|
|
||||||
<viewLayoutGuide key="safeArea" id="VUw-jc-0yf"/>
|
<viewLayoutGuide key="safeArea" id="VUw-jc-0yf"/>
|
||||||
</view>
|
</view>
|
||||||
<toolbarItems>
|
<toolbarItems>
|
||||||
@ -112,7 +103,7 @@
|
|||||||
<outlet property="prevArticleBarButtonItem" destination="v4j-fq-23N" id="Gny-Oh-cQa"/>
|
<outlet property="prevArticleBarButtonItem" destination="v4j-fq-23N" id="Gny-Oh-cQa"/>
|
||||||
<outlet property="readBarButtonItem" destination="hy0-LS-MzE" id="BzM-x9-tuj"/>
|
<outlet property="readBarButtonItem" destination="hy0-LS-MzE" id="BzM-x9-tuj"/>
|
||||||
<outlet property="starBarButtonItem" destination="wU4-eH-wC9" id="Z8Q-Lt-dKk"/>
|
<outlet property="starBarButtonItem" destination="wU4-eH-wC9" id="Z8Q-Lt-dKk"/>
|
||||||
<outlet property="webView" destination="t8d-md-Yhc" id="Iqg-bg-wds"/>
|
<outlet property="webViewContainer" destination="DNb-lt-KzC" id="Fc1-Ae-pWK"/>
|
||||||
</connections>
|
</connections>
|
||||||
</viewController>
|
</viewController>
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="FJe-Yq-33r" sceneMemberID="firstResponder"/>
|
<placeholder placeholderIdentifier="IBFirstResponder" id="FJe-Yq-33r" sceneMemberID="firstResponder"/>
|
||||||
|
@ -14,22 +14,36 @@ import SafariServices
|
|||||||
|
|
||||||
class DetailViewController: UIViewController {
|
class DetailViewController: UIViewController {
|
||||||
|
|
||||||
@IBOutlet weak var nextUnreadBarButtonItem: UIBarButtonItem!
|
@IBOutlet private weak var nextUnreadBarButtonItem: UIBarButtonItem!
|
||||||
@IBOutlet weak var prevArticleBarButtonItem: UIBarButtonItem!
|
@IBOutlet private weak var prevArticleBarButtonItem: UIBarButtonItem!
|
||||||
@IBOutlet weak var nextArticleBarButtonItem: UIBarButtonItem!
|
@IBOutlet private weak var nextArticleBarButtonItem: UIBarButtonItem!
|
||||||
@IBOutlet weak var readBarButtonItem: UIBarButtonItem!
|
@IBOutlet private weak var readBarButtonItem: UIBarButtonItem!
|
||||||
@IBOutlet weak var starBarButtonItem: UIBarButtonItem!
|
@IBOutlet private weak var starBarButtonItem: UIBarButtonItem!
|
||||||
@IBOutlet weak var actionBarButtonItem: UIBarButtonItem!
|
@IBOutlet private weak var actionBarButtonItem: UIBarButtonItem!
|
||||||
@IBOutlet weak var browserBarButtonItem: UIBarButtonItem!
|
@IBOutlet private weak var browserBarButtonItem: UIBarButtonItem!
|
||||||
@IBOutlet weak var webView: WKWebView!
|
@IBOutlet private weak var webViewContainer: UIView!
|
||||||
|
private var webView: WKWebView!
|
||||||
|
|
||||||
weak var coordinator: AppCoordinator!
|
weak var coordinator: AppCoordinator!
|
||||||
|
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
|
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
|
|
||||||
|
webView = WKWebView(frame: webViewContainer.bounds)
|
||||||
|
webView.translatesAutoresizingMaskIntoConstraints = false
|
||||||
webView.navigationDelegate = self
|
webView.navigationDelegate = self
|
||||||
|
|
||||||
|
webViewContainer.addSubview(webView)
|
||||||
|
|
||||||
|
let constraints: [NSLayoutConstraint] = [
|
||||||
|
webView.leadingAnchor.constraint(equalTo: webViewContainer.safeAreaLayoutGuide.leadingAnchor),
|
||||||
|
webView.trailingAnchor.constraint(equalTo: webViewContainer.safeAreaLayoutGuide.trailingAnchor),
|
||||||
|
webView.topAnchor.constraint(equalTo: webViewContainer.safeAreaLayoutGuide.topAnchor),
|
||||||
|
webView.bottomAnchor.constraint(equalTo: webViewContainer.safeAreaLayoutGuide.bottomAnchor),
|
||||||
|
]
|
||||||
|
|
||||||
|
NSLayoutConstraint.activate(constraints)
|
||||||
|
|
||||||
markAsRead()
|
markAsRead()
|
||||||
updateUI()
|
updateUI()
|
||||||
reloadHTML()
|
reloadHTML()
|
||||||
|
Loading…
Reference in New Issue
Block a user