Change Feeds background color and update to emulate plain style tables more closely. Issue #1224

This commit is contained in:
Maurice Parker 2019-11-01 06:34:26 -05:00
parent b78b996e88
commit 5720034f19
4 changed files with 38 additions and 28 deletions

View File

@ -173,7 +173,7 @@
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" id="r7i-6Z-zg0"> <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" id="r7i-6Z-zg0">
<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"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/> <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<prototypes> <prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="Cell" id="zNG-5C-pQm" customClass="MasterFeedTableViewCell" customModule="NetNewsWire" customModuleProvider="target"> <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="Cell" id="zNG-5C-pQm" customClass="MasterFeedTableViewCell" customModule="NetNewsWire" customModuleProvider="target">
<rect key="frame" x="0.0" y="55.5" width="414" height="43.5"/> <rect key="frame" x="0.0" y="55.5" width="414" height="43.5"/>
@ -182,6 +182,7 @@
<rect key="frame" x="0.0" y="0.0" width="414" height="43.5"/> <rect key="frame" x="0.0" y="0.0" width="414" height="43.5"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
</tableViewCellContentView> </tableViewCellContentView>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
</tableViewCell> </tableViewCell>
</prototypes> </prototypes>
<sections/> <sections/>

View File

@ -169,7 +169,7 @@ private extension MasterFeedTableViewSectionHeader {
func addBackgroundView() { func addBackgroundView() {
self.backgroundView = UIView(frame: self.bounds) self.backgroundView = UIView(frame: self.bounds)
self.backgroundView?.backgroundColor = UIColor.systemGroupedBackground self.backgroundView?.backgroundColor = UIColor.secondarySystemBackground
} }
} }

View File

@ -7,13 +7,21 @@
{ {
"idiom" : "universal", "idiom" : "universal",
"color" : { "color" : {
"color-space" : "srgb", "platform" : "ios",
"components" : { "reference" : "systemBackgroundColor"
"red" : "1.000",
"alpha" : "1.000",
"blue" : "1.000",
"green" : "1.000"
} }
},
{
"idiom" : "universal",
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"platform" : "ios",
"reference" : "systemBackgroundColor"
} }
} }
] ]

View File

@ -32,22 +32,16 @@ class ThemedNavigationController: UINavigationController {
private func configure() { private func configure() {
isToolbarHidden = false isToolbarHidden = false
if traitCollection.userInterfaceStyle == .dark {
navigationBar.standardAppearance = UINavigationBarAppearance()
navigationBar.tintColor = AppAssets.primaryAccentColor
toolbar.standardAppearance = UIToolbarAppearance()
toolbar.compactAppearance = UIToolbarAppearance()
toolbar.tintColor = AppAssets.primaryAccentColor
} else {
let navigationAppearance = UINavigationBarAppearance() let navigationAppearance = UINavigationBarAppearance()
navigationAppearance.backgroundColor = AppAssets.barBackgroundColor let backgroundImage = AppAssets.barBackgroundColor.image()
navigationAppearance.backgroundImage = backgroundImage
navigationAppearance.titleTextAttributes = [.foregroundColor: UIColor.label] navigationAppearance.titleTextAttributes = [.foregroundColor: UIColor.label]
navigationAppearance.largeTitleTextAttributes = [.foregroundColor: UIColor.label] navigationAppearance.largeTitleTextAttributes = [.foregroundColor: UIColor.label]
navigationBar.standardAppearance = navigationAppearance navigationBar.standardAppearance = navigationAppearance
navigationBar.tintColor = AppAssets.primaryAccentColor navigationBar.tintColor = AppAssets.primaryAccentColor
let toolbarAppearance = UIToolbarAppearance() let toolbarAppearance = UIToolbarAppearance()
toolbarAppearance.backgroundColor = UIColor.white toolbarAppearance.backgroundImage = backgroundImage
toolbar.standardAppearance = toolbarAppearance toolbar.standardAppearance = toolbarAppearance
toolbar.compactAppearance = toolbarAppearance toolbar.compactAppearance = toolbarAppearance
toolbar.tintColor = AppAssets.primaryAccentColor toolbar.tintColor = AppAssets.primaryAccentColor
@ -55,4 +49,11 @@ class ThemedNavigationController: UINavigationController {
} }
extension UIColor {
func image(_ size: CGSize = CGSize(width: 1, height: 1)) -> UIImage {
return UIGraphicsImageRenderer(size: size).image { rendererContext in
self.setFill()
rendererContext.fill(CGRect(origin: .zero, size: size))
}
}
} }