Skip to content

Commit

Permalink
UI Adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
jfeigel committed May 1, 2020
1 parent 6e7fd97 commit 0c3b161
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 44 deletions.
2 changes: 1 addition & 1 deletion Catalogr.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,11 @@
isa = PBXGroup;
children = (
176CEFF9244658490054E12C /* BookshelfCollectionViewCell.swift */,
17FF1768245A94BE0042C240 /* RoundFillButton.swift */,
174042732450D2CA0034287C /* SearchTableViewCell.swift */,
17B2EA9F243D74FE00EBDE97 /* SettingsToggleTableViewCell.swift */,
17B2EAA1243D759D00EBDE97 /* SettingsPickerTableViewCell.swift */,
17E654DD24417C87007DEFF6 /* TabBarController.swift */,
17FF1768245A94BE0042C240 /* RoundFillButton.swift */,
);
path = Components;
sourceTree = "<group>";
Expand Down
79 changes: 46 additions & 33 deletions Catalogr/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="16096" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="9pA-Xk-hfw">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<device id="retina6_1" orientation="portrait" appearance="dark"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
Expand Down Expand Up @@ -367,21 +367,34 @@
<rect key="frame" x="0.0" y="0.0" width="414" height="842"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<navigationBar contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="uEY-QG-bAV">
<rect key="frame" x="0.0" y="0.0" width="414" height="56"/>
<items>
<navigationItem title="Add Book" id="0Y5-e9-PQW">
<barButtonItem key="leftBarButtonItem" systemItem="cancel" id="Jhu-0S-hyk">
<color key="tintColor" systemColor="systemRedColor" red="1" green="0.23137254900000001" blue="0.18823529410000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<connections>
<action selector="dismiss:" destination="SEb-62-AS2" id="7fo-wm-WXG"/>
</connections>
</barButtonItem>
</navigationItem>
</items>
</navigationBar>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="fillEqually" alignment="center" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="cbE-r5-T6d">
<rect key="frame" x="20" y="20" width="374" height="788"/>
<rect key="frame" x="20" y="76" width="374" height="732"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="vgl-5L-Uhn">
<rect key="frame" x="0.0" y="0.0" width="374" height="384"/>
<rect key="frame" x="0.0" y="0.0" width="374" height="356"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="agJ-BB-jwn">
<rect key="frame" x="123" y="100.5" width="128" height="183"/>
<rect key="frame" x="123" y="86.5" width="128" height="183"/>
<constraints>
<constraint firstAttribute="width" constant="128" id="m4T-bF-U7c"/>
<constraint firstAttribute="height" constant="183" id="zdR-f9-Wiz"/>
</constraints>
</imageView>
<activityIndicatorView hidden="YES" opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" style="large" translatesAutoresizingMaskIntoConstraints="NO" id="Jd2-TA-fYm">
<rect key="frame" x="168.5" y="173.5" width="37" height="37"/>
<rect key="frame" x="168.5" y="159.5" width="37" height="37"/>
</activityIndicatorView>
</subviews>
<color key="backgroundColor" red="0.56470588235294117" green="0.87450980392156863" blue="0.95686274509803915" alpha="1" colorSpace="calibratedRGB"/>
Expand All @@ -393,7 +406,7 @@
</constraints>
</view>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="l3W-62-OSx">
<rect key="frame" x="0.0" y="404" width="374" height="384"/>
<rect key="frame" x="0.0" y="376" width="374" height="356"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="center" text="Title" textAlignment="center" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4Dp-ln-NGQ">
<rect key="frame" x="169.5" y="0.0" width="35.5" height="20.5"/>
Expand All @@ -408,58 +421,56 @@
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="249" text="" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="YcA-aU-2Qw">
<rect key="frame" x="187" y="78.5" width="0.0" height="252.5"/>
<rect key="frame" x="187" y="78.5" width="0.0" height="149.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="y6b-zK-QVE">
<rect key="frame" x="20" y="351" width="334" height="33"/>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="fillEqually" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="y6b-zK-QVE">
<rect key="frame" x="20" y="248" width="334" height="108"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="tPk-Ju-x6m" customClass="RoundFillButton" customModule="Catalogr" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="98" height="33"/>
<color key="backgroundColor" systemColor="systemRedColor" red="1" green="0.23137254900000001" blue="0.18823529410000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="33" id="XUz-k9-WgF"/>
</constraints>
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<state key="normal" image="xmark" catalog="system"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="rounded" value="YES"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="dismiss:" destination="3Jv-xV-Ypd" eventType="touchUpInside" id="OsG-Pe-fdz"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ghS-XQ-NZr" customClass="RoundFillButton" customModule="Catalogr" customModuleProvider="target">
<rect key="frame" x="118" y="0.0" width="98" height="33"/>
<rect key="frame" x="0.0" y="0.0" width="334" height="44"/>
<color key="backgroundColor" systemColor="systemBlueColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="33" id="WXm-ME-JNm"/>
<constraint firstAttribute="height" constant="44" id="WXm-ME-JNm"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<state key="normal" image="book" catalog="system">
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="20" maxY="0.0"/>
<state key="normal" title="Add to Bookshelf" image="book" catalog="system">
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="rounded" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="radius">
<real key="value" value="10"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="shadowRadius">
<real key="value" value="10"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="addBook:" destination="3Jv-xV-Ypd" eventType="touchUpInside" id="X4T-uL-sdP"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="bWJ-Tk-EO7" customClass="RoundFillButton" customModule="Catalogr" customModuleProvider="target">
<rect key="frame" x="236" y="0.0" width="98" height="33"/>
<rect key="frame" x="0.0" y="64" width="334" height="44"/>
<color key="backgroundColor" systemColor="systemBlueColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="33" id="veI-tF-SCi"/>
<constraint firstAttribute="height" constant="44" id="veI-tF-SCi"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<state key="normal" image="heart" catalog="system">
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="20" maxY="0.0"/>
<state key="normal" title="Add to Wishlist" image="heart" catalog="system">
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="rounded" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="radius">
<real key="value" value="10"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="addBook:" destination="3Jv-xV-Ypd" eventType="touchUpInside" id="8yC-mi-s45"/>
Expand All @@ -485,10 +496,13 @@
</subviews>
<color key="backgroundColor" systemColor="secondarySystemBackgroundColor" red="0.94901960780000005" green="0.94901960780000005" blue="0.96862745100000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="uEY-QG-bAV" firstAttribute="leading" secondItem="D4C-Ob-jZw" secondAttribute="leading" id="Ggq-Ea-leG"/>
<constraint firstItem="cbE-r5-T6d" firstAttribute="trailing" secondItem="gFW-xq-S2D" secondAttribute="trailingMargin" id="SyH-XG-uiD"/>
<constraint firstItem="cbE-r5-T6d" firstAttribute="top" secondItem="D4C-Ob-jZw" secondAttribute="top" constant="20" id="jvd-XE-GFg"/>
<constraint firstItem="cbE-r5-T6d" firstAttribute="bottom" secondItem="D4C-Ob-jZw" secondAttribute="bottom" id="t2j-lp-Ggk"/>
<constraint firstItem="D4C-Ob-jZw" firstAttribute="bottom" secondItem="cbE-r5-T6d" secondAttribute="bottom" id="gXO-4H-YxK"/>
<constraint firstItem="cbE-r5-T6d" firstAttribute="top" secondItem="uEY-QG-bAV" secondAttribute="bottom" constant="20" id="jvd-XE-GFg"/>
<constraint firstItem="uEY-QG-bAV" firstAttribute="trailing" secondItem="D4C-Ob-jZw" secondAttribute="trailing" id="vVS-jE-Yxn"/>
<constraint firstItem="cbE-r5-T6d" firstAttribute="leading" secondItem="gFW-xq-S2D" secondAttribute="leadingMargin" id="xoJ-wW-R6U"/>
<constraint firstItem="uEY-QG-bAV" firstAttribute="top" secondItem="D4C-Ob-jZw" secondAttribute="top" id="yKi-Gg-T4A"/>
</constraints>
<viewLayoutGuide key="safeArea" id="D4C-Ob-jZw"/>
</view>
Expand Down Expand Up @@ -746,6 +760,5 @@
<image name="gear" catalog="system" width="128" height="119"/>
<image name="heart" catalog="system" width="128" height="109"/>
<image name="magnifyingglass" catalog="system" width="128" height="115"/>
<image name="xmark" catalog="system" width="128" height="113"/>
</resources>
</document>
35 changes: 34 additions & 1 deletion Catalogr/Components/RoundFillButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,41 @@ import UIKit
}
}

@IBInspectable var radius: CGFloat = 0 {
didSet {
updateButton()
}
}

@IBInspectable var dropShadow: Bool = false {
didSet {
updateButton()
}
}

@IBInspectable var shadowRadius: CGFloat = 0 {
didSet {
updateButton()
}
}

func updateButton() {
layer.cornerRadius = rounded ? frame.size.height / 2 : 0
if rounded == true {
layer.cornerRadius = radius != 0 ? radius : frame.size.height / 2
} else {
layer.cornerRadius = 0
}

if dropShadow {
layer.masksToBounds = false
layer.shadowColor = UIColor.black.cgColor
layer.shadowOffset = .zero//CGSize(width: 0, height: 2)
layer.shadowOpacity = 0.5
layer.shadowPath = UIBezierPath(rect: self.bounds).cgPath
layer.shadowRadius = shadowRadius
layer.shouldRasterize = true
layer.rasterizationScale = UIScreen.main.scale
}
}

}
Loading

0 comments on commit 0c3b161

Please sign in to comment.