Skip to content

Commit

Permalink
Demo 调整
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyouPrince committed Feb 5, 2024
1 parent 828441e commit b70cbfd
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 8 deletions.
16 changes: 8 additions & 8 deletions XYNav/Example/XYNav/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19455" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="8D7-1r-JWC">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="22155" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="8D7-1r-JWC">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19454"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22131"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand Down Expand Up @@ -71,10 +71,10 @@
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" id="t2v-W9-mss">
<rect key="frame" x="0.0" y="44.5" width="375" height="43.5"/>
<rect key="frame" x="0.0" y="50" width="375" height="44.5"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="t2v-W9-mss" id="KGv-gV-MLD">
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="44.5"/>
<autoresizingMask key="autoresizingMask"/>
</tableViewCellContentView>
</tableViewCell>
Expand All @@ -95,7 +95,7 @@
<objects>
<navigationController storyboardIdentifier="xynav" id="wTj-AU-THX" customClass="XYNavigationController" customModule="XYNav" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" id="7cd-nU-Y0H">
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<connections>
Expand All @@ -109,11 +109,11 @@
<!--Item-->
<scene sceneID="g4t-q7-5ML">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="rOs-4I-STN" customClass="XYNavigationController" customModule="XYNav" sceneMemberID="viewController">
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="rOs-4I-STN" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" title="Item" id="rhu-r7-Jxb"/>
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="CZc-hX-4B6">
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
Expand Down Expand Up @@ -204,7 +204,7 @@
<tabBarItem key="tabBarItem" title="Item" id="3sE-z0-CLr"/>
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="cmJ-io-qoz">
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
Expand Down
34 changes: 34 additions & 0 deletions XYNav/Example/XYNav/GreenViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,40 @@ import UIKit
class GreenViewController: BaseViewController {

var hideNavBar = false

// override var preferredStatusBarStyle: UIStatusBarStyle {
// if #available(iOS 13.0, *) {
// return UIStatusBarStyle.darkContent
// } else {
// // Fallback on earlier versions
// return UIStatusBarStyle.default
// }
// }
//
override var prefersStatusBarHidden: Bool {
true
}

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)

// UIApplication.shared.setStatusBarHidden(true, with: .fade)
// UIApplication.shared.isStatusBarHidden = true

if #available(iOS 13.0, *) {
let scenes = UIApplication.shared.connectedScenes
for scene in scenes {
if let wins = scene as? UIWindowScene {
let frame = wins.statusBarManager?.statusBarFrame ?? .zero
let hidden = wins.statusBarManager?.isStatusBarHidden ?? true
let style = wins.statusBarManager?.statusBarStyle ?? .lightContent
print("\(frame)\n\(hidden)\n\(style)")
}
}
} else {
// Fallback on earlier versions
}
}

override func viewDidLoad() {
super.viewDidLoad()
Expand Down
2 changes: 2 additions & 0 deletions XYNav/Example/XYNav/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
<array>
<string>armv7</string>
</array>
<key>UIStatusBarStyle</key>
<string></string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
Expand Down
25 changes: 25 additions & 0 deletions XYNav/Example/XYNav/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,29 @@ class ViewController: BaseViewController {
self.title = "RootVC - \(index)"
self.view.addSubview(tableView)
}


override var preferredStatusBarStyle: UIStatusBarStyle {
if #available(iOS 13.0, *) {
return UIStatusBarStyle.darkContent
} else {
// Fallback on earlier versions
return UIStatusBarStyle.default
}
}

override var prefersStatusBarHidden: Bool {
true
}

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)

// UIApplication.shared.setStatusBarHidden(true, with: .fade)
UIApplication.shared.isStatusBarHidden = true
}


override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
// navigationBar 需要在此函数中才能被加载到,
Expand All @@ -87,6 +110,8 @@ class ViewController: BaseViewController {
// self.tabBarController?.tabBar.isTranslucent = false
self.navigationController?.navigationBar.barTintColor = UIColor.xy_getColor(hex: 0x006aff)



// tabbar 透明
tabBarController?.tabBar.isTranslucent = true

Expand Down

0 comments on commit b70cbfd

Please sign in to comment.