Skip to content

Instantly share code, notes, and snippets.

@DonMag
Last active August 23, 2018 18:13
Show Gist options
  • Save DonMag/108f929c3ad27098f0291d9bc40c150b to your computer and use it in GitHub Desktop.
Save DonMag/108f929c3ad27098f0291d9bc40c150b to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="Rlh-Vg-cv5">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Table Table View Controller-->
<scene sceneID="7ic-Sq-rwF">
<objects>
<tableViewController id="saA-VE-Toe" customClass="TVTableTableViewController" customModule="SW4Temp" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" id="dpj-9R-TLw">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="TVCell" id="Np6-4r-d7g" customClass="TVCell" customModule="SW4Temp" customModuleProvider="target">
<rect key="frame" x="0.0" y="28" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="Np6-4r-d7g" id="05U-ve-HQq">
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" scrollEnabled="NO" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="mdt-gs-Y3i">
<rect key="frame" x="8" y="8" width="359" height="27.5"/>
<color key="backgroundColor" red="0.45138680930000002" green="0.99309605359999997" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="27.5" id="Nyf-MM-ogd"/>
</constraints>
<string key="text">Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.</string>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView>
</subviews>
<constraints>
<constraint firstItem="mdt-gs-Y3i" firstAttribute="leading" secondItem="05U-ve-HQq" secondAttribute="leading" constant="8" id="ZJj-nL-orc"/>
<constraint firstAttribute="trailing" secondItem="mdt-gs-Y3i" secondAttribute="trailing" constant="8" id="brD-tM-ut7"/>
<constraint firstItem="mdt-gs-Y3i" firstAttribute="top" secondItem="05U-ve-HQq" secondAttribute="top" constant="8" id="eoW-Vk-Q0i"/>
<constraint firstAttribute="bottom" secondItem="mdt-gs-Y3i" secondAttribute="bottom" constant="8" id="fKg-GZ-S3Z"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="theTextView" destination="mdt-gs-Y3i" id="lUr-iQ-mZT"/>
</connections>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="saA-VE-Toe" id="l01-W0-w2d"/>
<outlet property="delegate" destination="saA-VE-Toe" id="ugw-8b-uMV"/>
</connections>
</tableView>
<navigationItem key="navigationItem" id="Nhg-Tv-43f"/>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="1Vr-qv-HhS" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1148" y="171.36431784107947"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="q3u-og-4tm">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="Rlh-Vg-cv5" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="twV-cP-PSJ">
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="saA-VE-Toe" kind="relationship" relationship="rootViewController" id="E0G-7p-GDr"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iER-Bo-8S2" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="208.80000000000001" y="171.36431784107947"/>
</scene>
</scenes>
</document>
//
// TVTableTableViewController.swift
// SW4Temp
//
// Created by Don Mag on 8/23/18.
// Copyright © 2018 DonMag. All rights reserved.
//
import UIKit
class TVCell: UITableViewCell, UITextViewDelegate {
@IBOutlet var theTextView: UITextView!
var callBack: ((UITextView) -> ())?
override func awakeFromNib() {
super.awakeFromNib()
// in case these were not set in IB
theTextView.delegate = self
theTextView.isScrollEnabled = false
}
func textViewDidChange(_ textView: UITextView) {
// tell controller the text changed
callBack?(textView)
}
}
class TVTableTableViewController: UITableViewController {
var textData = Array(repeating: "", count: 4)
override func viewDidLoad() {
super.viewDidLoad()
tableView.rowHeight = UITableViewAutomaticDimension
tableView.estimatedRowHeight = 60
}
// MARK: - Table view data source
override func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return textData.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "TVCell", for: indexPath) as! TVCell
cell.theTextView.text = textData[indexPath.row]
cell.callBack = {
textView in
self.textData[indexPath.row] = textView.text
self.tableView.beginUpdates()
self.tableView.endUpdates()
}
return cell
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment