-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#330] Add a dedicated cell for About tab
- Loading branch information
1 parent
38f03fe
commit c6d717d
Showing
7 changed files
with
139 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
Scribe/Components/UITableViewCells/AboutTableViewCell.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// | ||
// Copyright (C) 2023 Scribe | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
// | ||
|
||
import UIKit | ||
|
||
final class AboutTableViewCell: UITableViewCell { | ||
|
||
// MARK: - Constants | ||
|
||
static let reuseIdentifier = String(describing: InfoChildTableViewCell.self) | ||
|
||
// MARK: - Properties | ||
|
||
@IBOutlet var titleLabel: UILabel! | ||
@IBOutlet var iconImageView: UIImageView! | ||
|
||
var section: Section? | ||
var parentSection: Section? | ||
|
||
// MARK: - Functions | ||
|
||
func configureCell(for section: Section) { | ||
selectionStyle = .none | ||
|
||
titleLabel.text = section.sectionTitle | ||
|
||
if let icon = section.imageString { | ||
iconImageView.image = UIImage.availableIconImage(with: icon) | ||
iconImageView.constraints.forEach { $0.isActive = true } | ||
} else { | ||
iconImageView.image = nil | ||
iconImageView.constraints.forEach { $0.isActive = false } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22155" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> | ||
<device id="retina6_12" orientation="portrait" appearance="light"/> | ||
<dependencies> | ||
<deployment identifier="iOS"/> | ||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22131"/> | ||
<capability name="Named colors" minToolsVersion="9.0"/> | ||
<capability name="Safe area layout guides" minToolsVersion="9.0"/> | ||
<capability name="System colors in document resources" minToolsVersion="11.0"/> | ||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> | ||
</dependencies> | ||
<objects> | ||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> | ||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> | ||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="132" id="KGk-i7-Jjw" customClass="AboutTableViewCell" customModule="Scribe" customModuleProvider="target"> | ||
<rect key="frame" x="0.0" y="0.0" width="486" height="132"/> | ||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> | ||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM"> | ||
<rect key="frame" x="0.0" y="0.0" width="486" height="132"/> | ||
<autoresizingMask key="autoresizingMask"/> | ||
<subviews> | ||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="AJP-R8-VkX"> | ||
<rect key="frame" x="50" y="53" width="428" height="26"/> | ||
<constraints> | ||
<constraint firstAttribute="height" constant="26" id="W9s-aE-Zx6"/> | ||
</constraints> | ||
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/> | ||
<nil key="textColor"/> | ||
<nil key="highlightedColor"/> | ||
</label> | ||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="MSu-WY-MCY"> | ||
<rect key="frame" x="16" y="53" width="26" height="26"/> | ||
<color key="tintColor" name="keyChar"/> | ||
<constraints> | ||
<constraint firstAttribute="width" constant="26" id="Fay-e2-5uF"/> | ||
<constraint firstAttribute="height" constant="26" id="Vwp-c3-IiP"/> | ||
</constraints> | ||
</imageView> | ||
</subviews> | ||
<color key="backgroundColor" systemColor="systemBackgroundColor"/> | ||
<constraints> | ||
<constraint firstItem="MSu-WY-MCY" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="6Yr-Bm-4Cx"/> | ||
<constraint firstItem="MSu-WY-MCY" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="k6M-7f-ePY"/> | ||
<constraint firstItem="AJP-R8-VkX" firstAttribute="centerY" secondItem="MSu-WY-MCY" secondAttribute="centerY" id="twY-UQ-o7I"/> | ||
<constraint firstItem="AJP-R8-VkX" firstAttribute="leading" secondItem="MSu-WY-MCY" secondAttribute="trailing" constant="8" id="udY-dz-eEL"/> | ||
<constraint firstAttribute="trailing" secondItem="AJP-R8-VkX" secondAttribute="trailing" constant="8" id="wI4-UY-kS6"/> | ||
</constraints> | ||
</tableViewCellContentView> | ||
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/> | ||
<connections> | ||
<outlet property="iconImageView" destination="MSu-WY-MCY" id="EMy-K1-jZa"/> | ||
<outlet property="titleLabel" destination="AJP-R8-VkX" id="urL-z2-Msc"/> | ||
</connections> | ||
<point key="canvasLocation" x="265.64885496183206" y="50.70422535211268"/> | ||
</tableViewCell> | ||
</objects> | ||
<resources> | ||
<namedColor name="keyChar"> | ||
<color red="0.0" green="0.0" blue="0.0" alpha="0.89999997615814209" colorSpace="custom" customColorSpace="sRGB"/> | ||
</namedColor> | ||
<systemColor name="systemBackgroundColor"> | ||
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | ||
</systemColor> | ||
</resources> | ||
</document> |
Oops, something went wrong.