Skip to content

Bug Report - cannot hide Keyboard in Say for iOS #50 Fix #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from Sep 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion iOS/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,14 @@
<barButtonItem style="plain" systemItem="flexibleSpace" id="7vD-ZR-bfQ"/>
</items>
</toolbar>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" text="Hello, World!" translatesAutoresizingMaskIntoConstraints="NO" id="Vpa-uC-abB">
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" misplaced="YES" text="Hello, World!" translatesAutoresizingMaskIntoConstraints="NO" id="Vpa-uC-abB">
<frame key="frameInset" minY="64" width="375" height="559"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" name=".AppleSystemUIFont" family=".AppleSystemUIFont" pointSize="14"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
<connections>
<outlet property="delegate" destination="BYZ-38-t0r" id="UfC-c5-zne"/>
</connections>
</textView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Rate" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="XrO-IB-k1e">
<fontDescription key="fontDescription" type="system" pointSize="17"/>
Expand All @@ -58,6 +62,7 @@
</slider>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<gestureRecognizers/>
<constraints>
<constraint firstItem="NJt-HC-7Os" firstAttribute="top" secondItem="Vpa-uC-abB" secondAttribute="bottom" constant="100" id="8Ze-6b-SOk"/>
<constraint firstItem="NJt-HC-7Os" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" id="CuI-jy-ZLd"/>
Expand All @@ -83,12 +88,19 @@
</barButtonItem>
</navigationItem>
<connections>
<outlet property="panGesture" destination="tN7-AW-e4D" id="BQx-iJ-ZLX"/>
<outlet property="playButton" destination="hCx-7W-w6w" id="GjK-oQ-hkv"/>
<outlet property="rateLabel" destination="KaN-Qo-Ue9" id="E3V-ox-Cdf"/>
<outlet property="textView" destination="Vpa-uC-abB" id="yTS-Z0-ZEa"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
<panGestureRecognizer minimumNumberOfTouches="1" id="tN7-AW-e4D">
<connections>
<action selector="DismissKeyboardWithSender:" destination="BYZ-38-t0r" id="7PO-8q-HmU"/>
<outlet property="delegate" destination="BYZ-38-t0r" id="n9Z-zO-flE"/>
</connections>
</panGestureRecognizer>
</objects>
<point key="canvasLocation" x="964" y="36.431784107946029"/>
</scene>
Expand Down
14 changes: 11 additions & 3 deletions iOS/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@

import UIKit

class ViewController: UIViewController, SpeakerDelegate, UIPickerViewDelegate, UIPickerViewDataSource {
class ViewController: UIViewController, SpeakerDelegate, UIPickerViewDelegate, UIPickerViewDataSource{


@IBOutlet var panGesture: UIPanGestureRecognizer! = nil
@IBOutlet weak var textView: UITextView! = nil
@IBOutlet weak var playButton: UIBarButtonItem! = nil
@IBOutlet weak var rateLabel: UILabel! = nil
Expand Down Expand Up @@ -37,6 +39,11 @@ class ViewController: UIViewController, SpeakerDelegate, UIPickerViewDelegate, U
}
}


@IBAction func DismissKeyboard(sender: UIPanGestureRecognizer) {
self.view.endEditing(true)
}

@IBAction func stopClicked(_ sender: AnyObject) {
speaker.stopSpeaking()
isPaused = false
Expand Down Expand Up @@ -78,13 +85,14 @@ class ViewController: UIViewController, SpeakerDelegate, UIPickerViewDelegate, U

override func viewDidLoad() {
super.viewDidLoad()
self.view.addGestureRecognizer(panGesture)
speaker.delegate = self

//init language names
let voices = self.speaker.voices
for voice in voices {
languageNames.append(voice.name)
}

}

func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
Expand All @@ -100,7 +108,7 @@ class ViewController: UIViewController, SpeakerDelegate, UIPickerViewDelegate, U
func numberOfComponents(in pickerView: UIPickerView) -> Int {
return 1
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
Expand Down