[+] Add family add alarm table

This commit is contained in:
Hykilpikonna
2021-01-26 15:18:56 -05:00
parent ab95dbfe46
commit 2b9e54f485
3 changed files with 70 additions and 8 deletions
@@ -358,7 +358,7 @@ extension FamilyVC: UITableViewDelegate, UITableViewDataSource
*/
func tableView(_ view: UITableView, cellForRowAt i: IndexPath) -> UITableViewCell
{
let cell = view.dequeueReusableCell(withIdentifier: "cell", for: i)
let cell = view.dequeueReusableCell(withIdentifier: "family-member-cell", for: i)
cell.textLabel?.text = Family.fromLocal()!.membersList[i.row]
return cell
}
@@ -369,6 +369,7 @@ extension FamilyVC: UITableViewDelegate, UITableViewDataSource
func tableView(_ view: UITableView, didSelectRowAt i: IndexPath)
{
print(i.row)
view.deselectRow(at: i, animated: true)
}
}
@@ -461,3 +462,51 @@ class FamilyCreateJoinVC: UIViewController
}
}
/**
View controller for adding an alarm to a fmaily member
*/
class FamilyAddAlarmVC: UIViewController
{
@IBOutlet weak var table: UITableView!
override func viewDidLoad()
{
super.viewDidLoad()
table.delegate = self
table.dataSource = self
}
}
/**
Table data source
*/
extension FamilyAddAlarmVC: UITableViewDelegate, UITableViewDataSource
{
/**
Define row count
*/
func tableView(_ _: UITableView, numberOfRowsInSection _: Int) -> Int
{
return Alarms.fromLocal().list.count
}
/**
Set cell at i
*/
func tableView(_ view: UITableView, cellForRowAt i: IndexPath) -> UITableViewCell
{
let cell = view.dequeueReusableCell(withIdentifier: "family-alarm-cell", for: i)
let alarm = Alarms.fromLocal().list[i.row]
cell.textLabel?.text = String(format: "%i:%02i", alarm.hour, alarm.minute)
return cell
}
/**
Called when the user clicks on the cell at i
*/
func tableView(_ view: UITableView, didSelectRowAt i: IndexPath)
{
view.deselectRow(at: i, animated: true)
}
}
+16 -3
View File
@@ -1117,10 +1117,10 @@
</objects>
<point key="canvasLocation" x="1664" y="2271"/>
</scene>
<!--View Controller-->
<!--Family Add AlarmVC-->
<scene sceneID="nfh-Af-0i6">
<objects>
<viewController id="tsc-Sa-flN" sceneMemberID="viewController">
<viewController id="tsc-Sa-flN" customClass="FamilyAddAlarmVC" customModule="ProjectClock" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="cjq-um-dZr">
<rect key="frame" x="0.0" y="0.0" width="414" height="650"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
@@ -1128,6 +1128,16 @@
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="Tnv-t2-x4g">
<rect key="frame" x="20" y="191" width="374" height="439"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="family-alarm-cell" id="Suf-xg-DzL">
<rect key="frame" x="0.0" y="28" width="374" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="Suf-xg-DzL" id="Ic2-YQ-FgT">
<rect key="frame" x="0.0" y="0.0" width="374" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
</tableViewCellContentView>
</tableViewCell>
</prototypes>
</tableView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Family" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vbG-Sp-h0i">
<rect key="frame" x="20" y="20" width="374" height="20.5"/>
@@ -1168,6 +1178,9 @@
</constraints>
</view>
<navigationItem key="navigationItem" id="g8i-R5-KT9"/>
<connections>
<outlet property="table" destination="Tnv-t2-x4g" id="lsv-3K-jRC"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="8aw-Tn-lRs" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
@@ -1200,7 +1213,7 @@
<rect key="frame" x="0.0" y="30.5" width="374" height="354.5"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="cell" rowHeight="66" id="PpM-BI-Arz">
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="family-member-cell" rowHeight="66" id="PpM-BI-Arz">
<rect key="frame" x="0.0" y="28" width="374" height="66"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="PpM-BI-Arz" id="zXh-kT-4wz">