update support isTranslucent

This commit is contained in:
mrustaa
2023-12-24 14:23:18 +03:00
parent 831b2f144f
commit 0534cba5df
10 changed files with 41 additions and 67 deletions
@@ -18,18 +18,17 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="gqJ-oN-JCK">
<rect key="frame" x="87.5" y="50" width="200" height="50"/>
<rect key="frame" x="110.5" y="50" width="154" height="50"/>
<constraints>
<constraint firstAttribute="width" constant="200" id="3QE-nw-Od3"/>
<constraint firstAttribute="height" constant="50" id="MXC-rS-qfY"/>
</constraints>
<fontDescription key="fontDescription" name="HelveticaNeue-Bold" family="Helvetica Neue" pointSize="20"/>
<fontDescription key="fontDescription" name="HelveticaNeue-Bold" family="Helvetica Neue" pointSize="18"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" title="isTranslucent True">
<state key="normal" title="isTranslucent true">
<color key="titleColor" systemColor="systemBlueColor"/>
</state>
<connections>
<action selector="buttonChangeTranslucent:" destination="p3c-kf-PfN" eventType="touchUpInside" id="FG2-xH-GUG"/>
<action selector="btnChangeTranslucentAction:" destination="p3c-kf-PfN" eventType="touchUpInside" id="hjO-rR-Ij1"/>
</connections>
</button>
</subviews>
@@ -40,6 +39,9 @@
<constraint firstItem="gqJ-oN-JCK" firstAttribute="centerX" secondItem="jmi-Lo-St4" secondAttribute="centerX" id="Crs-BD-puY"/>
</constraints>
</view>
<connections>
<outlet property="btnChangeTranslucent" destination="gqJ-oN-JCK" id="34t-Kh-blv"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Uzt-sR-4xA" sceneMemberID="firstResponder"/>
</objects>
@@ -48,10 +50,10 @@
</scenes>
<resources>
<systemColor name="opaqueSeparatorColor">
<color red="0.77647058820000003" green="0.77647058820000003" blue="0.7843137255" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.77647058823529413" green="0.77647058823529413" blue="0.78431372549019607" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="systemBlueColor">
<color red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.0" green="0.47843137254901963" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
</resources>
</document>
@@ -13,6 +13,7 @@ class ExampleAddCollectionViewController: StoryboardController {
var container: ContainerController!
@IBOutlet var btnChangeTranslucent: UIButton!
// MARK: - Init
override func viewDidLoad() {
@@ -20,6 +21,8 @@ class ExampleAddCollectionViewController: StoryboardController {
title = "Example Add CollectionView"
btnUpdateText()
let layoutC = ContainerLayout()
layoutC.positions = ContainerPosition(top: 100, middle: 250, bottom: 70)
container = ContainerController(addTo: self, layout: layoutC)
@@ -31,21 +34,26 @@ class ExampleAddCollectionViewController: StoryboardController {
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
navigationController?.navigationBar.isTranslucent = true
container.move(type: .middle)
}
@IBAction func buttonChangeTranslucent(_ sender: UIButton) {
@IBAction func btnChangeTranslucentAction(_ sender: UIButton) {
guard let translucent = navigationController?.navigationBar.isTranslucent else { return }
navigationController?.navigationBar.isTranslucent = !translucent
btnUpdateText()
container.move(type: container.moveType)
}
func btnUpdateText() {
guard let translucent = navigationController?.navigationBar.isTranslucent else { return }
btnChangeTranslucent.setTitle("NavBar isTranslucent \(translucent)", for: .normal)
}
func addCollectionView() -> UICollectionView {