Commit ef27a35c by Javier Heisekce

Agrega estilo al header de la seccion

parent 8fc25034
......@@ -19,16 +19,8 @@
<rect key="frame" x="0.0" y="44" width="375" height="623"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" id="l8U-st-Wic">
<rect key="frame" x="0.0" y="28" width="375" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="l8U-st-Wic" id="FAe-5V-uSO">
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
</tableViewCellContentView>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="contactName" id="QkB-8k-kbX">
<rect key="frame" x="0.0" y="71.5" width="375" height="43.5"/>
<rect key="frame" x="0.0" y="28" width="375" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="QkB-8k-kbX" id="AMU-de-w3M">
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
......@@ -59,7 +51,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="On8-yo-4E7" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1414.4927536231885" y="63.616071428571423"/>
<point key="canvasLocation" x="1413.5999999999999" y="63.418290854572717"/>
</scene>
<!--Single Contact View Controller-->
<scene sceneID="wAp-rN-Dr5">
......
......@@ -27,7 +27,7 @@
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="0.90924546632124348" green="0.90924546632124348" blue="0.90924546632124348" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
<color key="backgroundColor" cocoaTouchSystemColor="lightTextColor"/>
<constraints>
<constraint firstItem="vUN-kp-3ea" firstAttribute="bottom" secondItem="2Vg-Y7-9zD" secondAttribute="bottom" constant="1" id="M1Z-qU-8CJ"/>
<constraint firstItem="rgh-bc-PuT" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" constant="16" id="PMm-R4-l0c"/>
......
......@@ -8,14 +8,8 @@
import UIKit
class ContactSectionView: UIView {
class ContactSectionView: UITableViewHeaderFooterView {
@IBOutlet weak var labelLetter: UILabel!
@IBOutlet weak var labelExpandable: UIButton!
override func draw(_ rect: CGRect) {
super .draw(rect)
//title.text = "Jahata"
}
}
......@@ -18,6 +18,7 @@ class ContactsViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
contactsTable.register(UINib(nibName: "ContactSection", bundle: nil), forHeaderFooterViewReuseIdentifier: "headerId")
importContacts()
contactsTable.tableFooterView = UIView(frame: .zero)
}
......@@ -110,14 +111,15 @@ extension ContactsViewController: UITableViewDelegate, UITableViewDataSource {
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let button = UIButton(type: .system)
button.setTitle("Λ", for: .normal)
button.setTitleColor(.black, for: .normal)
button.titleLabel?.font = UIFont.boldSystemFont(ofSize: 15)
button.backgroundColor = .systemGray4
button.addTarget(self, action: #selector(interactSection), for: .touchUpInside)
button.tag = section
return button//ʌΛ
let header = contactsTable.dequeueReusableHeaderFooterView(withIdentifier: "headerId") as! ContactSectionView
header.contentView.backgroundColor = .systemGray4
header.labelExpandable.setTitle("Λ", for: .normal)
header.labelExpandable.setTitleColor(.black, for: .normal)
header.labelExpandable.titleLabel?.font = UIFont.boldSystemFont(ofSize: 15)
header.labelExpandable.addTarget(self, action: #selector(interactSection), for: .touchUpInside)
header.labelExpandable.tag = section
header.labelLetter.text = contactStructArray[section].letter
return header//ʌΛ
}
@objc func interactSection(button : UIButton) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment