Merge pull request #1211 from jbennett/feature/1185-add-highlight-background-to-vibrant-button

Delete account button should highlight red
This commit is contained in:
Maurice Parker 2019-10-28 12:58:46 -05:00 committed by GitHub
commit e032d7911f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 57 additions and 3 deletions

View File

@ -1,8 +1,9 @@
<?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="15504" 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="15400" 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="15508"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15404"/>
<capability name="Named colors" 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>
<scenes> <scenes>
@ -118,6 +119,14 @@
<state key="normal" title="Delete Account"> <state key="normal" title="Delete Account">
<color key="titleColor" systemColor="systemRedColor" red="1" green="0.23137254900000001" blue="0.18823529410000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="titleColor" systemColor="systemRedColor" red="1" green="0.23137254900000001" blue="0.18823529410000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state> </state>
<state key="highlighted">
<color key="titleColor" systemColor="systemRedColor" red="1" green="0.23137254900000001" blue="0.18823529410000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="backgroundHighlightColor">
<color key="value" name="deleteBackgroundColor"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections> <connections>
<action selector="deleteAccount:" destination="1m3-fZ-n7g" eventType="touchUpInside" id="gYt-Fi-Eqe"/> <action selector="deleteAccount:" destination="1m3-fZ-n7g" eventType="touchUpInside" id="gYt-Fi-Eqe"/>
</connections> </connections>
@ -166,4 +175,9 @@
<point key="canvasLocation" x="157" y="-591"/> <point key="canvasLocation" x="157" y="-591"/>
</scene> </scene>
</scenes> </scenes>
<resources>
<namedColor name="deleteBackgroundColor">
<color red="0.22745098039215686" green="0.22745098039215686" blue="0.23529411764705882" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
</resources>
</document> </document>

View File

@ -0,0 +1,38 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
},
"colors" : [
{
"idiom" : "universal",
"color" : {
"color-space" : "srgb",
"components" : {
"red" : "0xD1",
"alpha" : "1.000",
"blue" : "0xD6",
"green" : "0xD1"
}
}
},
{
"idiom" : "universal",
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"red" : "0x3A",
"alpha" : "1.000",
"blue" : "0x3C",
"green" : "0x3A"
}
}
}
]
}

View File

@ -10,6 +10,8 @@ import UIKit
class VibrantButton: UIButton { class VibrantButton: UIButton {
@IBInspectable var backgroundHighlightColor: UIColor = AppAssets.secondaryAccentColor
override init(frame: CGRect) { override init(frame: CGRect) {
super.init(frame: frame) super.init(frame: frame)
commonInit() commonInit()
@ -25,7 +27,7 @@ class VibrantButton: UIButton {
override var isHighlighted: Bool { override var isHighlighted: Bool {
didSet { didSet {
backgroundColor = isHighlighted ? AppAssets.secondaryAccentColor : nil backgroundColor = isHighlighted ? backgroundHighlightColor : nil
titleLabel?.alpha = 1 titleLabel?.alpha = 1
} }
} }