Commit 8a0939ba authored by yqz's avatar yqz

dsf

parent 3e972c5f
......@@ -36,12 +36,12 @@ class SpeakEleTabbarViewCtr: UIViewController {
}
private func AddchildVC() -> Void {
let home = TabbarButton(title: "Home", normalImage: "icon_home_weixuan", selectImage: "icon_home_yixuan")
let home = TabbarButton(title: "Home", normalImage: nil, selectImage: nil)
let homevc = SpeakEleHomeViewCtr()
self.addChild(homevc)
contentStack.addArrangedSubview(homevc.view)
let set = TabbarButton(title: "Setting", normalImage: "icon_Settings_weixuan", selectImage: "icon_Settings_yixuan")
let set = TabbarButton(title: "Setting", normalImage: nil, selectImage: nil)
let setvc = SpeakEleSetViewCtr()
self.addChild(setvc)
contentStack.addArrangedSubview(setvc.view)
......@@ -120,7 +120,7 @@ class SpeakEleTabbarViewCtr: UIViewController {
class TabbarButton: UIButton {
convenience init(title:String?, normalImage:String, selectImage:String) {
convenience init(title:String?, normalImage:String?, selectImage:String?) {
self.init(type: .custom)
var configs = UIButton.Configuration.filled()
configs.title = title
......@@ -139,10 +139,12 @@ class TabbarButton: UIButton {
var updateConfigs = button.configuration
if button.isSelected {
updateConfigs?.baseForegroundColor = .init(with: "#17CB81")
updateConfigs?.image = UIImage(named: selectImage)?.withRenderingMode(.alwaysOriginal)
guard let simg = selectImage else { return }
updateConfigs?.image = UIImage(named: simg)?.withRenderingMode(.alwaysOriginal)
}else{
updateConfigs?.baseForegroundColor = .gray
updateConfigs?.image = UIImage(named: normalImage)?.withRenderingMode(.alwaysOriginal)
guard let img = normalImage else { return}
updateConfigs?.image = UIImage(named: img)?.withRenderingMode(.alwaysOriginal)
}
button.configuration = updateConfigs
}
......
......@@ -10,26 +10,9 @@ import UIKit
class SpeakEleHomeViewCtr: SpeakEleBaseViewCtr {
@IBOutlet weak var inputText: UITextField!
@IBOutlet weak var PlayerView: UIView!
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
}
@IBAction func voice(_ sender: Any) {
self.view.layoutIfNeeded()
let text = inputText.text ?? ""
let sub = SpeakVideoPlayer.share.videoPlayer(3.1)
let player = SpeakVideoPlayer.share.players[safe: sub]
let playerLayer = SpeakVideoPlayer.share.playerLayers[safe: sub]
playerLayer?.frame = PlayerView.bounds
PlayerView.layer.addSublayer(playerLayer ?? CALayer())
player?.play()
SpeakSpeechSynthesizer.share.speakText(text)
}
}
......@@ -10,8 +10,6 @@
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="SpeakEleHomeViewCtr" customModule="SpeakEasyLearnEnglish" customModuleProvider="target">
<connections>
<outlet property="PlayerView" destination="BpM-GJ-E6Q" id="aZp-Su-jpC"/>
<outlet property="inputText" destination="hZO-Fd-dgW" id="pMk-QA-tkf"/>
<outlet property="view" destination="Ia2-3z-Nib" id="Fy8-sN-P1j"/>
</connections>
</placeholder>
......@@ -19,58 +17,9 @@
<view contentMode="scaleToFill" id="Ia2-3z-Nib">
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<textField opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="248" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="I have achieved academic success and will go global" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="hZO-Fd-dgW">
<rect key="frame" x="0.0" y="401" width="393" height="50"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="MPE-Lf-ewE"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="borderColor">
<color key="value" systemColor="labelColor"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
<real key="value" value="1"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="corners">
<real key="value" value="6"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</textField>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="BpM-GJ-E6Q">
<rect key="frame" x="0.0" y="0.0" width="393" height="452"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="f9P-fF-oCz">
<rect key="frame" x="159" y="474" width="75" height="35"/>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="plain" title="Button"/>
<connections>
<action selector="voice:" destination="-1" eventType="touchUpInside" id="Oir-5p-BbV"/>
</connections>
</button>
</subviews>
<viewLayoutGuide key="safeArea" id="rqH-oW-agY"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="hZO-Fd-dgW" firstAttribute="leading" secondItem="BpM-GJ-E6Q" secondAttribute="leading" id="3hk-NC-Oax"/>
<constraint firstAttribute="bottom" secondItem="BpM-GJ-E6Q" secondAttribute="bottom" constant="400" id="8g8-qI-QNB"/>
<constraint firstItem="f9P-fF-oCz" firstAttribute="centerX" secondItem="Ia2-3z-Nib" secondAttribute="centerX" id="GV3-nT-lr2"/>
<constraint firstItem="rqH-oW-agY" firstAttribute="trailing" secondItem="BpM-GJ-E6Q" secondAttribute="trailing" id="Psr-Sd-Wxc"/>
<constraint firstItem="hZO-Fd-dgW" firstAttribute="centerY" secondItem="Ia2-3z-Nib" secondAttribute="centerY" id="cX7-Vj-slv"/>
<constraint firstItem="BpM-GJ-E6Q" firstAttribute="top" secondItem="Ia2-3z-Nib" secondAttribute="top" id="cfj-21-07u"/>
<constraint firstItem="BpM-GJ-E6Q" firstAttribute="leading" secondItem="rqH-oW-agY" secondAttribute="leading" id="hN5-j8-6Gi"/>
<constraint firstItem="hZO-Fd-dgW" firstAttribute="trailing" secondItem="BpM-GJ-E6Q" secondAttribute="trailing" id="r5v-5u-5mI"/>
<constraint firstItem="f9P-fF-oCz" firstAttribute="top" secondItem="hZO-Fd-dgW" secondAttribute="bottom" constant="23" id="vCF-bl-BqC"/>
</constraints>
<point key="canvasLocation" x="519.84732824427476" y="-37.323943661971832"/>
</view>
</objects>
<resources>
<systemColor name="labelColor">
<color white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>
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