Skip to content

Commit 791927d

Browse files
author
boye.hou
committed
adjust UI
adjust UI
1 parent 80c6adb commit 791927d

File tree

9 files changed

+244
-65
lines changed

9 files changed

+244
-65
lines changed

AtomeMerchantDemo/AtomeMerchantDemo.xcodeproj/project.pbxproj

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@
1414
A29237E62510ABD2007770F3 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A29237E52510ABD2007770F3 /* AppDelegate.swift */; };
1515
A29237E82510ABD3007770F3 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A29237E72510ABD3007770F3 /* SceneDelegate.swift */; };
1616
A29237EA2510ABD3007770F3 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A29237E92510ABD3007770F3 /* ViewController.swift */; };
17-
A29237ED2510ABD3007770F3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A29237EB2510ABD3007770F3 /* Main.storyboard */; };
1817
A29237EF2510ABD5007770F3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A29237EE2510ABD5007770F3 /* Assets.xcassets */; };
1918
A29237F22510ABD5007770F3 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A29237F02510ABD5007770F3 /* LaunchScreen.storyboard */; };
2019
A29237FB2510B165007770F3 /* NetworkRequester in Frameworks */ = {isa = PBXBuildFile; productRef = A29237FA2510B165007770F3 /* NetworkRequester */; };
2120
A29238032511B5B4007770F3 /* ConfirmOrderRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = A29238022511B5B4007770F3 /* ConfirmOrderRequest.swift */; };
21+
A2F9BA39273A477A009A0353 /* HomeContentArchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2F9BA38273A477A009A0353 /* HomeContentArchView.swift */; };
22+
A2F9BA3C273A54B9009A0353 /* HomeContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2F9BA3B273A54B9009A0353 /* HomeContentView.swift */; };
2223
FDA8E8E68A63BB0A7268EBC5 /* libPods-AtomeMerchantDemo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8ECE80E5BE60542C55F1D367 /* libPods-AtomeMerchantDemo.a */; };
2324
/* End PBXBuildFile section */
2425

@@ -34,12 +35,13 @@
3435
A29237E52510ABD2007770F3 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
3536
A29237E72510ABD3007770F3 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
3637
A29237E92510ABD3007770F3 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
37-
A29237EC2510ABD3007770F3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
3838
A29237EE2510ABD5007770F3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
3939
A29237F12510ABD5007770F3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
4040
A29237F32510ABD5007770F3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
4141
A29238012510B750007770F3 /* AtomeMerchantDemo.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = AtomeMerchantDemo.entitlements; sourceTree = "<group>"; };
4242
A29238022511B5B4007770F3 /* ConfirmOrderRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfirmOrderRequest.swift; sourceTree = "<group>"; };
43+
A2F9BA38273A477A009A0353 /* HomeContentArchView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeContentArchView.swift; sourceTree = "<group>"; };
44+
A2F9BA3B273A54B9009A0353 /* HomeContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeContentView.swift; sourceTree = "<group>"; };
4345
/* End PBXFileReference section */
4446

4547
/* Begin PBXFrameworksBuildPhase section */
@@ -97,19 +99,28 @@
9799
A29237E52510ABD2007770F3 /* AppDelegate.swift */,
98100
A29237E72510ABD3007770F3 /* SceneDelegate.swift */,
99101
A29237E92510ABD3007770F3 /* ViewController.swift */,
100-
A22329662739028700E19785 /* HomeViewController.swift */,
102+
A2F9BA3A273A4780009A0353 /* Home */,
101103
A236780025874CDB00E2C1E6 /* ViewHeader.swift */,
102104
A29238022511B5B4007770F3 /* ConfirmOrderRequest.swift */,
103105
A22329682739043900E19785 /* GradientButton.swift */,
104106
A23677FD258747B500E2C1E6 /* ColorPalette.swift */,
105-
A29237EB2510ABD3007770F3 /* Main.storyboard */,
106107
A29237EE2510ABD5007770F3 /* Assets.xcassets */,
107108
A29237F02510ABD5007770F3 /* LaunchScreen.storyboard */,
108109
A29237F32510ABD5007770F3 /* Info.plist */,
109110
);
110111
path = AtomeMerchantDemo;
111112
sourceTree = "<group>";
112113
};
114+
A2F9BA3A273A4780009A0353 /* Home */ = {
115+
isa = PBXGroup;
116+
children = (
117+
A22329662739028700E19785 /* HomeViewController.swift */,
118+
A2F9BA3B273A54B9009A0353 /* HomeContentView.swift */,
119+
A2F9BA38273A477A009A0353 /* HomeContentArchView.swift */,
120+
);
121+
path = Home;
122+
sourceTree = "<group>";
123+
};
113124
/* End PBXGroup section */
114125

115126
/* Begin PBXNativeTarget section */
@@ -178,7 +189,6 @@
178189
files = (
179190
A29237F22510ABD5007770F3 /* LaunchScreen.storyboard in Resources */,
180191
A29237EF2510ABD5007770F3 /* Assets.xcassets in Resources */,
181-
A29237ED2510ABD3007770F3 /* Main.storyboard in Resources */,
182192
);
183193
runOnlyForDeploymentPostprocessing = 0;
184194
};
@@ -232,7 +242,9 @@
232242
buildActionMask = 2147483647;
233243
files = (
234244
A29237EA2510ABD3007770F3 /* ViewController.swift in Sources */,
245+
A2F9BA39273A477A009A0353 /* HomeContentArchView.swift in Sources */,
235246
A29237E62510ABD2007770F3 /* AppDelegate.swift in Sources */,
247+
A2F9BA3C273A54B9009A0353 /* HomeContentView.swift in Sources */,
236248
A22329672739028700E19785 /* HomeViewController.swift in Sources */,
237249
A22329692739043900E19785 /* GradientButton.swift in Sources */,
238250
A29237E82510ABD3007770F3 /* SceneDelegate.swift in Sources */,
@@ -245,14 +257,6 @@
245257
/* End PBXSourcesBuildPhase section */
246258

247259
/* Begin PBXVariantGroup section */
248-
A29237EB2510ABD3007770F3 /* Main.storyboard */ = {
249-
isa = PBXVariantGroup;
250-
children = (
251-
A29237EC2510ABD3007770F3 /* Base */,
252-
);
253-
name = Main.storyboard;
254-
sourceTree = "<group>";
255-
};
256260
A29237F02510ABD5007770F3 /* LaunchScreen.storyboard */ = {
257261
isa = PBXVariantGroup;
258262
children = (

AtomeMerchantDemo/AtomeMerchantDemo/Base.lproj/Main.storyboard

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
//
2+
// HomeContentArchView.swift
3+
// AtomeMerchantDemo
4+
//
5+
// Created by boye on 2021/11/9.
6+
// Copyright © 2021 boye. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
class HomeContentArchView: UIView {
12+
static let contentHeight: CGFloat = 600
13+
14+
private let archCoverView = UIImageView()
15+
private let centerView = UIView()
16+
private let centerViewHeight: CGFloat = 180
17+
private let centerViewWidth: CGFloat = UIScreen.main.bounds.width - 30
18+
19+
override init(frame: CGRect) {
20+
super.init(frame: frame)
21+
22+
archCoverView.backgroundColor = UIColor.white
23+
archCoverView.layer.cornerRadius = 5
24+
addSubview(archCoverView)
25+
archCoverView.snp.makeConstraints { (make) in
26+
make.leading.trailing.bottom.equalToSuperview()
27+
make.width.equalToSuperview()
28+
make.top.equalToSuperview().offset(73)
29+
make.height.equalTo(HomeContentArchView.contentHeight)
30+
}
31+
32+
addSubview(centerView)
33+
centerView.layer.cornerRadius = 10
34+
centerView.backgroundColor = UIColor.white
35+
36+
let path = UIBezierPath()
37+
let shadowGap: CGFloat = 10
38+
path.move(to: CGPoint(x: -3, y: 0))
39+
path.addLine(to: CGPoint(x: -3, y: centerViewHeight - shadowGap))
40+
path.addLine(to: CGPoint(x: 0, y: centerViewHeight - shadowGap))
41+
path.addLine(to: CGPoint(x: -3, y: 0))
42+
path.move(to: CGPoint(x: centerViewWidth, y: 0))
43+
path.addLine(to: CGPoint(x: centerViewWidth, y: centerViewHeight - shadowGap))
44+
path.addLine(to: CGPoint(x: centerViewWidth + 3, y: centerViewHeight - shadowGap))
45+
path.addLine(to: CGPoint(x: centerViewWidth + 3, y: 0))
46+
path.close()
47+
centerView.layer.shadowPath = path.cgPath
48+
centerView.layer.shadowColor = UIColor(red: 9.0 / 255.0, green: 152.0 / 255.0, blue: 255.0 / 255.0, alpha: 0.8).cgColor
49+
centerView.layer.shadowOpacity = 0.8
50+
centerView.layer.shadowRadius = 10
51+
centerView.layer.shadowOffset = CGSize(width: 3, height: 0)
52+
53+
centerView.snp.makeConstraints { (make) in
54+
make.leading.equalTo(15)
55+
make.trailing.equalTo(-15)
56+
make.top.equalToSuperview()
57+
make.height.equalTo(centerViewHeight)
58+
}
59+
}
60+
61+
override func layoutSubviews() {
62+
super.layoutSubviews()
63+
}
64+
65+
required init?(coder: NSCoder) {
66+
fatalError("init(coder:) has not been implemented")
67+
}
68+
69+
func addViews(_ contentView: UIView) {
70+
// just layout
71+
addSubview(contentView)
72+
contentView.snp.makeConstraints { (make) in
73+
make.leading.trailing.equalTo(centerView)
74+
make.top.equalTo(centerView)
75+
make.bottom.equalTo(archCoverView)
76+
}
77+
}
78+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
//
2+
// HomeContentView.swift
3+
// AtomeMerchantDemo
4+
//
5+
// Created by boye on 2021/11/9.
6+
// Copyright © 2021 boye. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
class HomeContentView: UIView {
12+
var getStartCallback: (()->Void)?
13+
14+
private let descLabel = UILabel()
15+
private let gettingStartButton = GradientButton(title: "Get start")
16+
17+
override init(frame: CGRect) {
18+
super.init(frame: frame)
19+
setupUI()
20+
}
21+
22+
required init?(coder: NSCoder) {
23+
fatalError("init(coder:) has not been implemented")
24+
}
25+
26+
private func setupUI() {
27+
descLabel.textAlignment = .center
28+
descLabel.font = UIFont.boldSystemFont(ofSize: 15)
29+
descLabel.textColor = UIColor.darkGray
30+
descLabel.text = "Click the button below to start"
31+
addSubview(descLabel)
32+
descLabel.snp.makeConstraints { make in
33+
make.top.equalToSuperview().offset(50)
34+
make.leading.equalToSuperview().offset(15)
35+
make.trailing.equalToSuperview().offset(-15)
36+
}
37+
38+
addSubview(gettingStartButton)
39+
gettingStartButton.layer.cornerRadius = GradientButton.buttonSize.height / 2
40+
gettingStartButton.snp.makeConstraints { make in
41+
make.centerX.equalToSuperview()
42+
make.top.equalTo(descLabel.snp.bottom).offset(30)
43+
make.size.equalTo(GradientButton.buttonSize)
44+
}
45+
46+
gettingStartButton.addTarget(self, action: #selector(getStartAction), for: .touchUpInside)
47+
}
48+
49+
@objc private func getStartAction() {
50+
getStartCallback?()
51+
}
52+
}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
//
2+
// HomeViewController.swift
3+
// AtomeMerchantDemo
4+
//
5+
// Created by boye on 2021/11/8.
6+
// Copyright © 2021 boye. All rights reserved.
7+
//
8+
9+
import UIKit
10+
import SnapKit
11+
12+
class HomeViewController: UIViewController {
13+
private let backgroundImageView = UIImageView()
14+
private let bottomCoverView = UIView()
15+
private let logoImageView = UIImageView()
16+
private let scrollView = UIScrollView()
17+
private let contentView = UIView()
18+
private let coverView = HomeContentArchView()
19+
private let homeContentView = HomeContentView()
20+
21+
override func viewWillAppear(_ animated: Bool) {
22+
super.viewWillAppear(animated)
23+
navigationController?.navigationBar.setBackgroundImage(UIImage.init(), for: .default)
24+
navigationController?.navigationBar.shadowImage = UIImage.init()
25+
}
26+
27+
override func viewDidLoad() {
28+
super.viewDidLoad()
29+
30+
setupUI()
31+
setupAction()
32+
}
33+
34+
private func setupUI() {
35+
backgroundImageView.backgroundColor = UIColor.canary
36+
view.addSubview(backgroundImageView)
37+
backgroundImageView.snp.makeConstraints { (make) in
38+
make.edges.equalToSuperview()
39+
}
40+
41+
view.addSubview(bottomCoverView)
42+
bottomCoverView.backgroundColor = UIColor.white
43+
bottomCoverView.snp.makeConstraints { (make) in
44+
make.trailing.leading.bottom.equalToSuperview()
45+
make.height.equalTo(UIScreen.main.bounds.height / 2)
46+
}
47+
48+
logoImageView.image = UIImage(named: "logoDark")
49+
view.addSubview(logoImageView)
50+
logoImageView.snp.makeConstraints { (make) in
51+
make.top.equalTo(view.safeAreaLayoutGuide.snp.top).offset(38)
52+
make.leading.equalToSuperview().offset(15)
53+
make.width.equalTo(110)
54+
make.height.equalTo(21)
55+
}
56+
57+
view.addSubview(scrollView)
58+
scrollView.showsVerticalScrollIndicator = false
59+
scrollView.showsHorizontalScrollIndicator = false
60+
scrollView.snp.makeConstraints { (make) in
61+
make.leading.trailing.bottom.equalToSuperview()
62+
make.top.equalTo(logoImageView.snp.bottom).offset(30)
63+
}
64+
65+
scrollView.addSubview(contentView)
66+
contentView.snp.makeConstraints { (make) in
67+
make.leading.trailing.top.bottom.equalToSuperview()
68+
make.width.equalToSuperview()
69+
}
70+
71+
contentView.addSubview(coverView)
72+
coverView.snp.makeConstraints { (make) in
73+
make.top.leading.trailing.bottom.equalToSuperview()
74+
make.width.equalToSuperview()
75+
make.height.equalTo(HomeContentArchView.contentHeight)
76+
}
77+
78+
coverView.addViews(homeContentView)
79+
}
80+
81+
private func setupAction() {
82+
homeContentView.getStartCallback = { [weak self] in
83+
guard let self = self else { return }
84+
let vc = ViewController()
85+
self.navigationController?.pushViewController(vc, animated: true)
86+
}
87+
}
88+
}

AtomeMerchantDemo/AtomeMerchantDemo/HomeViewController.swift

Lines changed: 0 additions & 18 deletions
This file was deleted.

AtomeMerchantDemo/AtomeMerchantDemo/Info.plist

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,12 @@
5050
<string>Default Configuration</string>
5151
<key>UISceneDelegateClassName</key>
5252
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
53-
<key>UISceneStoryboardFile</key>
54-
<string>Main</string>
5553
</dict>
5654
</array>
5755
</dict>
5856
</dict>
5957
<key>UILaunchStoryboardName</key>
6058
<string>LaunchScreen</string>
61-
<key>UIMainStoryboardFile</key>
62-
<string>Main</string>
6359
<key>UIRequiredDeviceCapabilities</key>
6460
<array>
6561
<string>armv7</string>

AtomeMerchantDemo/AtomeMerchantDemo/SceneDelegate.swift

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,13 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
1414

1515

1616
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
17-
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
18-
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
19-
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
20-
guard let _ = (scene as? UIWindowScene) else { return }
17+
guard let windowScene = (scene as? UIWindowScene) else { return }
18+
19+
window = UIWindow(windowScene: windowScene)
20+
let homeViewController = HomeViewController()
21+
let rootViewController = UINavigationController(rootViewController: homeViewController)
22+
window?.rootViewController = rootViewController
23+
window?.makeKeyAndVisible()
2124
}
2225

2326
func sceneDidDisconnect(_ scene: UIScene) {

0 commit comments

Comments
 (0)