Add RotorViewController

This commit is contained in:
Eryn Wells 2015-07-19 15:52:14 -07:00
parent c3a4f085f1
commit ff0cf30cc0
3 changed files with 88 additions and 0 deletions

View file

@ -0,0 +1,45 @@
//
// RotorViewController.swift
// Enigma
//
// Created by Eryn Wells on 2015-07-19.
// Copyright © 2015 Eryn Wells. All rights reserved.
//
import UIKit
class RotorViewController: UIViewController, UIPickerViewDataSource, UIPickerViewDelegate {
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var rotorPickerView: UIPickerView!
let rotor: Rotor
init(rotor: Rotor) {
self.rotor = rotor
super.init(nibName: nil, bundle: nil)
}
required init(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
super.viewDidLoad()
}
// MARK: - UIPickerViewDataSource
func numberOfComponentsInPickerView(pickerView: UIPickerView) -> Int {
return 1
}
func pickerView(pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
return Rotor.alphabet.count
}
// MARK: - UIPickerViewDelegate
func pickerView(pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
return String(Rotor.alphabet[row])
}
}

View file

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="8121.17" systemVersion="15A216g" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8101.14"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="RotorViewController" customModule="Enigma" customModuleProvider="target">
<connections>
<outlet property="rotorPickerView" destination="B6G-DY-Yjb" id="Pjq-Xb-533"/>
<outlet property="titleLabel" destination="VoV-Sa-FnF" id="GVQ-hB-vkd"/>
<outlet property="view" destination="a35-yW-MCu" id="DMP-uu-kcD"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="fillProportionally" id="a35-yW-MCu">
<rect key="frame" x="0.0" y="0.0" width="110" height="200"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="VoV-Sa-FnF" userLabel="title">
<rect key="frame" x="0.0" y="0.0" width="110" height="18"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<pickerView contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="B6G-DY-Yjb" userLabel="rotor">
<rect key="frame" x="0.0" y="18" width="110" height="182"/>
<animations/>
</pickerView>
</subviews>
<animations/>
<point key="canvasLocation" x="316" y="338"/>
</stackView>
</objects>
</document>