Commit 070e938e authored by Andres Käver's avatar Andres Käver

uitableview

parent 1a3762ce
......@@ -13,6 +13,9 @@
A9CEB79E257141C500E44726 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A9CEB79C257141C500E44726 /* Main.storyboard */; };
A9CEB7A0257141C600E44726 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A9CEB79F257141C600E44726 /* Assets.xcassets */; };
A9CEB7A3257141C600E44726 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A9CEB7A1257141C600E44726 /* LaunchScreen.storyboard */; };
A9CEB7AC257144CD00E44726 /* CustomTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9CEB7AB257144CD00E44726 /* CustomTableViewController.swift */; };
A9CEB7AF25714A5300E44726 /* Movie.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9CEB7AE25714A5300E44726 /* Movie.swift */; };
A9CEB7B2257150D500E44726 /* MovieTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9CEB7B1257150D500E44726 /* MovieTableViewCell.swift */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
......@@ -24,6 +27,9 @@
A9CEB79F257141C600E44726 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
A9CEB7A2257141C600E44726 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
A9CEB7A4257141C600E44726 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
A9CEB7AB257144CD00E44726 /* CustomTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomTableViewController.swift; sourceTree = "<group>"; };
A9CEB7AE25714A5300E44726 /* Movie.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Movie.swift; sourceTree = "<group>"; };
A9CEB7B1257150D500E44726 /* MovieTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MovieTableViewCell.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
......@@ -60,6 +66,9 @@
A9CEB798257141C500E44726 /* SceneDelegate.swift */,
A9CEB79A257141C500E44726 /* ViewController.swift */,
A9CEB79C257141C500E44726 /* Main.storyboard */,
A9CEB7B1257150D500E44726 /* MovieTableViewCell.swift */,
A9CEB7AB257144CD00E44726 /* CustomTableViewController.swift */,
A9CEB7AE25714A5300E44726 /* Movie.swift */,
A9CEB79F257141C600E44726 /* Assets.xcassets */,
A9CEB7A1257141C600E44726 /* LaunchScreen.storyboard */,
A9CEB7A4257141C600E44726 /* Info.plist */,
......@@ -137,9 +146,12 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
A9CEB7AC257144CD00E44726 /* CustomTableViewController.swift in Sources */,
A9CEB79B257141C500E44726 /* ViewController.swift in Sources */,
A9CEB7B2257150D500E44726 /* MovieTableViewCell.swift in Sources */,
A9CEB797257141C500E44726 /* AppDelegate.swift in Sources */,
A9CEB799257141C500E44726 /* SceneDelegate.swift in Sources */,
A9CEB7AF25714A5300E44726 /* Movie.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17506" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17505"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
......@@ -11,10 +13,22 @@
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="TableView Demo" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kHS-0h-ah3">
<rect key="frame" x="65.5" y="429" width="283.5" height="48"/>
<fontDescription key="fontDescription" type="system" pointSize="40"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="kHS-0h-ah3" firstAttribute="centerX" secondItem="6Tk-OE-BBY" secondAttribute="centerX" id="UIS-bM-7Uy"/>
<constraint firstItem="kHS-0h-ah3" firstAttribute="centerY" secondItem="6Tk-OE-BBY" secondAttribute="centerY" id="iE6-Yb-G0e"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
......@@ -22,4 +36,9 @@
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
<resources>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17506" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="CIu-wN-0qU">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17506"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<!--Custom Table View Controller-->
<scene sceneID="StG-Dx-1VO">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<tableViewController id="CIu-wN-0qU" customClass="CustomTableViewController" customModule="TableViewDemo" 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="uOo-qT-tRw">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="TableViewCell01" id="kTh-xd-PSh" customClass="MovieTableViewCell" customModule="TableViewDemo" customModuleProvider="target">
<rect key="frame" x="0.0" y="28" width="414" height="128"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="kTh-xd-PSh" id="IH4-k7-Fn9">
<rect key="frame" x="0.0" y="0.0" width="414" height="128"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="u1W-Uh-WFN">
<rect key="frame" x="20" y="0.0" width="250" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Lnv-Ws-Hes">
<rect key="frame" x="20" y="29" width="250" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rDy-cE-cql">
<rect key="frame" x="20" y="58" width="250" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="PYP-ef-kmE">
<rect key="frame" x="20" y="87" width="250" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="QMu-iU-5Fb">
<rect key="frame" x="278" y="4" width="120" height="120"/>
<color key="backgroundColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="width" secondItem="QMu-iU-5Fb" secondAttribute="height" multiplier="1:1" id="4KE-MS-iEG"/>
<constraint firstAttribute="height" constant="100" id="PPV-xo-hr1"/>
</constraints>
</imageView>
</subviews>
<color key="backgroundColor" systemColor="systemOrangeColor"/>
<constraints>
<constraint firstItem="Lnv-Ws-Hes" firstAttribute="top" secondItem="u1W-Uh-WFN" secondAttribute="bottom" constant="8" id="6qv-Ke-QzX"/>
<constraint firstItem="PYP-ef-kmE" firstAttribute="leading" secondItem="IH4-k7-Fn9" secondAttribute="leading" constant="20" symbolic="YES" id="Dd4-x5-dAi"/>
<constraint firstAttribute="trailing" secondItem="QMu-iU-5Fb" secondAttribute="trailing" constant="16" id="LVn-au-yft"/>
<constraint firstAttribute="bottom" secondItem="QMu-iU-5Fb" secondAttribute="bottom" constant="4" id="NYi-ed-DXT"/>
<constraint firstItem="Lnv-Ws-Hes" firstAttribute="leading" secondItem="IH4-k7-Fn9" secondAttribute="leading" constant="20" symbolic="YES" id="OT3-42-m3K"/>
<constraint firstItem="u1W-Uh-WFN" firstAttribute="leading" secondItem="IH4-k7-Fn9" secondAttribute="leading" constant="20" symbolic="YES" id="RDi-Cd-GBr"/>
<constraint firstItem="PYP-ef-kmE" firstAttribute="top" secondItem="rDy-cE-cql" secondAttribute="bottom" constant="8" id="Tds-Gx-zjd"/>
<constraint firstItem="u1W-Uh-WFN" firstAttribute="top" secondItem="IH4-k7-Fn9" secondAttribute="top" id="VDg-QD-00G"/>
<constraint firstItem="rDy-cE-cql" firstAttribute="top" secondItem="Lnv-Ws-Hes" secondAttribute="bottom" constant="8" id="coy-oY-VdA"/>
<constraint firstItem="rDy-cE-cql" firstAttribute="leading" secondItem="IH4-k7-Fn9" secondAttribute="leading" constant="20" symbolic="YES" id="cpl-1O-4nd"/>
<constraint firstItem="QMu-iU-5Fb" firstAttribute="leading" secondItem="Lnv-Ws-Hes" secondAttribute="trailing" constant="8" id="ctQ-Ym-Sp0"/>
<constraint firstItem="QMu-iU-5Fb" firstAttribute="leading" secondItem="rDy-cE-cql" secondAttribute="trailing" constant="8" id="m3h-vA-5IX"/>
<constraint firstItem="QMu-iU-5Fb" firstAttribute="leading" secondItem="u1W-Uh-WFN" secondAttribute="trailing" constant="8" id="pkq-nj-Zfd"/>
<constraint firstItem="QMu-iU-5Fb" firstAttribute="leading" secondItem="PYP-ef-kmE" secondAttribute="trailing" constant="8" id="wBA-dN-wpr"/>
<constraint firstItem="QMu-iU-5Fb" firstAttribute="top" secondItem="IH4-k7-Fn9" secondAttribute="top" constant="4" id="yCC-cM-6qF"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="label0" destination="u1W-Uh-WFN" id="3as-DJ-IIo"/>
<outlet property="label1" destination="Lnv-Ws-Hes" id="wyv-el-EGm"/>
<outlet property="label2" destination="rDy-cE-cql" id="jBt-Ou-Mrz"/>
<outlet property="label3" destination="PYP-ef-kmE" id="Bga-l3-yWJ"/>
<outlet property="movieImage" destination="QMu-iU-5Fb" id="EFr-IX-A81"/>
</connections>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="CIu-wN-0qU" id="K3X-K5-00D"/>
<outlet property="delegate" destination="CIu-wN-0qU" id="RUG-JQ-IVk"/>
</connections>
</tableView>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="jgm-m9-5Tv" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1789.8550724637682" y="56.919642857142854"/>
</scene>
</scenes>
<resources>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
<systemColor name="systemOrangeColor">
<color red="1" green="0.58431372549019611" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
</resources>
</document>
......@@ -9,6 +9,15 @@ import UIKit
class CustomTableViewController: UITableViewController {
var movies = [
Movie(id: 1, name: "The Matrix", rating: 9, year: 1999, director: "Wahowzki", image: "matrix", genre: "Sci-Fi", runtime: 136),
Movie(id: 2, name: "Pulp fiction", rating: 9.2, year: 1994, director: "Tarantino", image: "pulp", genre: "Crime, Drama", runtime: 136),
Movie(id: 3, name: "Mehed ei nuta", rating: 10, year: 1969, director: "Sulev Nõmmik", image: "mehed", genre: "Comedy", runtime: 136),
]
override func viewDidLoad() {
super.viewDidLoad()
......@@ -23,24 +32,47 @@ class CustomTableViewController: UITableViewController {
override func numberOfSections(in tableView: UITableView) -> Int {
// #warning Incomplete implementation, return the number of sections
return 0
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete implementation, return the number of rows
return 0
return movies.count
}
/*
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "reuseIdentifier", for: indexPath)
let cell = tableView.dequeueReusableCell(withIdentifier: "TableViewCell01", for: indexPath) as! MovieTableViewCell
// Configure the cell...
let movie = movies[indexPath.row]
/*
cell.textLabel?.text = movie.name + " - " + movie.director
cell.detailTextLabel?.text = "Released: \(movie.year) Rating: \(movie.rating)"
cell.imageView?.image = UIImage(named: movie.image)
*/
cell.label0.text = movie.name
cell.label1.text = movie.director
cell.label2.text = movie.genre
cell.label3.text = "Released: \(movie.year) Rating: \(movie.rating)"
cell.movieImage.image = UIImage(named: movie.image)
return cell
}
*/
/*
override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
return "Section header \(section)"
}
override func tableView(_ tableView: UITableView, titleForFooterInSection section: Int) -> String? {
return "Section footer \(section)"
}
*/
/*
// Override to support conditional editing of the table view.
override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
......
......@@ -6,3 +6,14 @@
//
import Foundation
struct Movie {
var id: Int
var name: String
var rating: Float
var year: Int
var director: String
var image: String
var genre: String
var runtime: Int
}
......@@ -9,6 +9,12 @@ import UIKit
class MovieTableViewCell: UITableViewCell {
@IBOutlet weak var movieImage: UIImageView!
@IBOutlet weak var label0: UILabel!
@IBOutlet weak var label1: UILabel!
@IBOutlet weak var label2: UILabel!
@IBOutlet weak var label3: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
......
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