Keep title for expanded notes
This commit is contained in:
@@ -613,9 +613,8 @@
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" fixedFrame="YES" showsHorizontalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="NXU-yU-eST">
|
||||
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="NXU-yU-eST">
|
||||
<rect key="frame" x="0.0" y="24" width="288" height="122"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
|
||||
<string key="text">1. Line
|
||||
2. Line
|
||||
@@ -631,7 +630,11 @@
|
||||
</subviews>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
|
||||
<constraints>
|
||||
<constraint firstItem="NXU-yU-eST" firstAttribute="leading" secondItem="ybL-UG-dwT" secondAttribute="leading" id="D6U-8L-f9m"/>
|
||||
<constraint firstAttribute="height" relation="greaterThanOrEqual" priority="750" constant="107" id="Pfy-uW-kRl"/>
|
||||
<constraint firstItem="NXU-yU-eST" firstAttribute="trailing" secondItem="ybL-UG-dwT" secondAttribute="trailing" id="eBc-6g-nWr"/>
|
||||
<constraint firstItem="NXU-yU-eST" firstAttribute="top" secondItem="QJp-6C-yoZ" secondAttribute="bottom" id="mnZ-WQ-LX8"/>
|
||||
<constraint firstItem="NXU-yU-eST" firstAttribute="bottom" secondItem="ybL-UG-dwT" secondAttribute="bottom" id="vFS-tG-E43"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="QiY-Mm-Dej" userLabel="Details">
|
||||
@@ -687,6 +690,7 @@ Duration: 60:00</string>
|
||||
<outlet property="inputDetails" destination="pql-H5-k6U" id="NXm-8f-5E6"/>
|
||||
<outlet property="inputNotes" destination="NXU-yU-eST" id="c2n-cG-aLq"/>
|
||||
<outlet property="inputTitle" destination="OCX-wu-l5d" id="PeC-F5-4mx"/>
|
||||
<outlet property="noteBottom" destination="vFS-tG-E43" id="Bxh-Tl-E2U"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="KN7-F1-BOL" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
|
||||
|
||||
@@ -9,6 +9,7 @@ class VCEditRecording: UIViewController, UITextFieldDelegate, UITextViewDelegate
|
||||
@IBOutlet private var inputTitle: UITextField!
|
||||
@IBOutlet private var inputNotes: UITextView!
|
||||
@IBOutlet private var inputDetails: UITextView!
|
||||
@IBOutlet private var noteBottom: NSLayoutConstraint!
|
||||
|
||||
override func viewDidLoad() {
|
||||
inputTitle.placeholder = record.fallbackTitle
|
||||
@@ -105,19 +106,14 @@ class VCEditRecording: UIViewController, UITextFieldDelegate, UITextViewDelegate
|
||||
guard let parent = inputNotes.superview, let stack = parent.superview else {
|
||||
return
|
||||
}
|
||||
let shouldAdjust = (isEditingNotes && keyboardHeight > 0)
|
||||
let noteTitle = parent.subviews.first!
|
||||
noteTitle.isHidden = shouldAdjust
|
||||
stack.subviews.forEach{ $0.isHidden = (shouldAdjust && $0 != parent) }
|
||||
let adjust = (isEditingNotes && keyboardHeight > 0)
|
||||
stack.subviews.forEach{ $0.isHidden = (adjust && $0 != parent) }
|
||||
|
||||
if shouldAdjust {
|
||||
inputNotes.frame.origin.y = 0
|
||||
inputNotes.frame.size.height = view.frame.height - keyboardHeight - stack.frame.minY - 4
|
||||
inputNotes.autoresizingMask = .init(arrayLiteral: .flexibleWidth, .flexibleBottomMargin)
|
||||
} else {
|
||||
inputNotes.frame.origin.y = noteTitle.frame.height
|
||||
inputNotes.frame.size.height = parent.frame.height - noteTitle.frame.height
|
||||
inputNotes.autoresizingMask = .init(arrayLiteral: .flexibleWidth, .flexibleHeight)
|
||||
}
|
||||
let title = parent.subviews.first as! UILabel
|
||||
title.font = .preferredFont(forTextStyle: adjust ? .subheadline : .title2)
|
||||
title.sizeToFit()
|
||||
title.frame.size.width = parent.frame.width
|
||||
|
||||
noteBottom.constant = adjust ? view.frame.height - stack.frame.maxY - keyboardHeight : 0
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user