Improve profile field layout

This commit is contained in:
Shadowfacts 2020-06-15 19:02:09 -04:00
parent 61c6d63c67
commit 6b7904ed52
Signed by untrusted user: shadowfacts
GPG Key ID: 94A5AB95422746E5
2 changed files with 14 additions and 4 deletions

View File

@ -110,6 +110,8 @@ class ProfileHeaderTableViewCell: UITableViewCell {
nameLabel.font = .boldSystemFont(ofSize: 17) nameLabel.font = .boldSystemFont(ofSize: 17)
nameLabel.textAlignment = .right nameLabel.textAlignment = .right
nameLabel.numberOfLines = 0 nameLabel.numberOfLines = 0
nameLabel.lineBreakMode = .byWordWrapping
nameLabel.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
fieldNamesStackView.addArrangedSubview(nameLabel) fieldNamesStackView.addArrangedSubview(nameLabel)
let valueTextView = ContentTextView() let valueTextView = ContentTextView()
@ -120,7 +122,10 @@ class ProfileHeaderTableViewCell: UITableViewCell {
valueTextView.textAlignment = .left valueTextView.textAlignment = .left
valueTextView.awakeFromNib() valueTextView.awakeFromNib()
valueTextView.navigationDelegate = delegate valueTextView.navigationDelegate = delegate
valueTextView.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
fieldValuesStackView.addArrangedSubview(valueTextView) fieldValuesStackView.addArrangedSubview(valueTextView)
nameLabel.heightAnchor.constraint(equalTo: valueTextView.heightAnchor).isActive = true
} }
if accountUpdater == nil { if accountUpdater == nil {

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies> <dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/>
@ -77,13 +78,17 @@
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillProportionally" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="sHU-GU-klv"> <stackView opaque="NO" contentMode="scaleToFill" distribution="fillProportionally" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="sHU-GU-klv">
<rect key="frame" x="16" y="238" width="343" height="50"/> <rect key="frame" x="16" y="238" width="343" height="50"/>
<subviews> <subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="fillEqually" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="pV2-Mz-54W"> <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="pV2-Mz-54W">
<rect key="frame" x="0.0" y="0.0" width="147" height="50"/> <rect key="frame" x="0.0" y="0.0" width="167.5" height="50"/>
</stackView> </stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="fillEqually" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="oza-9d-8v4"> <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="oza-9d-8v4">
<rect key="frame" x="155" y="0.0" width="188" height="50"/> <rect key="frame" x="175.5" y="0.0" width="167.5" height="50"/>
</stackView> </stackView>
</subviews> </subviews>
<constraints>
<constraint firstItem="oza-9d-8v4" firstAttribute="width" relation="lessThanOrEqual" secondItem="pV2-Mz-54W" secondAttribute="width" multiplier="2" id="LHm-6k-LyV"/>
<constraint firstItem="oza-9d-8v4" firstAttribute="width" relation="greaterThanOrEqual" secondItem="pV2-Mz-54W" secondAttribute="width" multiplier="0.5" id="Zbr-l3-Lff"/>
</constraints>
</stackView> </stackView>
<visualEffectView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="mQY-XN-PfZ"> <visualEffectView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="mQY-XN-PfZ">
<rect key="frame" x="335" y="110" width="32" height="32"/> <rect key="frame" x="335" y="110" width="32" height="32"/>