Skip to content

Commit

Permalink
adjust UI
Browse files Browse the repository at this point in the history
adjust UI
  • Loading branch information
boye.hou committed Nov 9, 2021
1 parent 80c6adb commit 791927d
Show file tree
Hide file tree
Showing 9 changed files with 244 additions and 65 deletions.
30 changes: 17 additions & 13 deletions AtomeMerchantDemo/AtomeMerchantDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
A29237E62510ABD2007770F3 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A29237E52510ABD2007770F3 /* AppDelegate.swift */; };
A29237E82510ABD3007770F3 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A29237E72510ABD3007770F3 /* SceneDelegate.swift */; };
A29237EA2510ABD3007770F3 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A29237E92510ABD3007770F3 /* ViewController.swift */; };
A29237ED2510ABD3007770F3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A29237EB2510ABD3007770F3 /* Main.storyboard */; };
A29237EF2510ABD5007770F3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A29237EE2510ABD5007770F3 /* Assets.xcassets */; };
A29237F22510ABD5007770F3 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A29237F02510ABD5007770F3 /* LaunchScreen.storyboard */; };
A29237FB2510B165007770F3 /* NetworkRequester in Frameworks */ = {isa = PBXBuildFile; productRef = A29237FA2510B165007770F3 /* NetworkRequester */; };
A29238032511B5B4007770F3 /* ConfirmOrderRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = A29238022511B5B4007770F3 /* ConfirmOrderRequest.swift */; };
A2F9BA39273A477A009A0353 /* HomeContentArchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2F9BA38273A477A009A0353 /* HomeContentArchView.swift */; };
A2F9BA3C273A54B9009A0353 /* HomeContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2F9BA3B273A54B9009A0353 /* HomeContentView.swift */; };
FDA8E8E68A63BB0A7268EBC5 /* libPods-AtomeMerchantDemo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8ECE80E5BE60542C55F1D367 /* libPods-AtomeMerchantDemo.a */; };
/* End PBXBuildFile section */

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

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -97,19 +99,28 @@
A29237E52510ABD2007770F3 /* AppDelegate.swift */,
A29237E72510ABD3007770F3 /* SceneDelegate.swift */,
A29237E92510ABD3007770F3 /* ViewController.swift */,
A22329662739028700E19785 /* HomeViewController.swift */,
A2F9BA3A273A4780009A0353 /* Home */,
A236780025874CDB00E2C1E6 /* ViewHeader.swift */,
A29238022511B5B4007770F3 /* ConfirmOrderRequest.swift */,
A22329682739043900E19785 /* GradientButton.swift */,
A23677FD258747B500E2C1E6 /* ColorPalette.swift */,
A29237EB2510ABD3007770F3 /* Main.storyboard */,
A29237EE2510ABD5007770F3 /* Assets.xcassets */,
A29237F02510ABD5007770F3 /* LaunchScreen.storyboard */,
A29237F32510ABD5007770F3 /* Info.plist */,
);
path = AtomeMerchantDemo;
sourceTree = "<group>";
};
A2F9BA3A273A4780009A0353 /* Home */ = {
isa = PBXGroup;
children = (
A22329662739028700E19785 /* HomeViewController.swift */,
A2F9BA3B273A54B9009A0353 /* HomeContentView.swift */,
A2F9BA38273A477A009A0353 /* HomeContentArchView.swift */,
);
path = Home;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -178,7 +189,6 @@
files = (
A29237F22510ABD5007770F3 /* LaunchScreen.storyboard in Resources */,
A29237EF2510ABD5007770F3 /* Assets.xcassets in Resources */,
A29237ED2510ABD3007770F3 /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -232,7 +242,9 @@
buildActionMask = 2147483647;
files = (
A29237EA2510ABD3007770F3 /* ViewController.swift in Sources */,
A2F9BA39273A477A009A0353 /* HomeContentArchView.swift in Sources */,
A29237E62510ABD2007770F3 /* AppDelegate.swift in Sources */,
A2F9BA3C273A54B9009A0353 /* HomeContentView.swift in Sources */,
A22329672739028700E19785 /* HomeViewController.swift in Sources */,
A22329692739043900E19785 /* GradientButton.swift in Sources */,
A29237E82510ABD3007770F3 /* SceneDelegate.swift in Sources */,
Expand All @@ -245,14 +257,6 @@
/* End PBXSourcesBuildPhase section */

/* Begin PBXVariantGroup section */
A29237EB2510ABD3007770F3 /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
A29237EC2510ABD3007770F3 /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
A29237F02510ABD5007770F3 /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
Expand Down
26 changes: 0 additions & 26 deletions AtomeMerchantDemo/AtomeMerchantDemo/Base.lproj/Main.storyboard

This file was deleted.

78 changes: 78 additions & 0 deletions AtomeMerchantDemo/AtomeMerchantDemo/Home/HomeContentArchView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
//
// HomeContentArchView.swift
// AtomeMerchantDemo
//
// Created by boye on 2021/11/9.
// Copyright © 2021 boye. All rights reserved.
//

import UIKit

class HomeContentArchView: UIView {
static let contentHeight: CGFloat = 600

private let archCoverView = UIImageView()
private let centerView = UIView()
private let centerViewHeight: CGFloat = 180
private let centerViewWidth: CGFloat = UIScreen.main.bounds.width - 30

override init(frame: CGRect) {
super.init(frame: frame)

archCoverView.backgroundColor = UIColor.white
archCoverView.layer.cornerRadius = 5
addSubview(archCoverView)
archCoverView.snp.makeConstraints { (make) in
make.leading.trailing.bottom.equalToSuperview()
make.width.equalToSuperview()
make.top.equalToSuperview().offset(73)
make.height.equalTo(HomeContentArchView.contentHeight)
}

addSubview(centerView)
centerView.layer.cornerRadius = 10
centerView.backgroundColor = UIColor.white

let path = UIBezierPath()
let shadowGap: CGFloat = 10
path.move(to: CGPoint(x: -3, y: 0))
path.addLine(to: CGPoint(x: -3, y: centerViewHeight - shadowGap))
path.addLine(to: CGPoint(x: 0, y: centerViewHeight - shadowGap))
path.addLine(to: CGPoint(x: -3, y: 0))
path.move(to: CGPoint(x: centerViewWidth, y: 0))
path.addLine(to: CGPoint(x: centerViewWidth, y: centerViewHeight - shadowGap))
path.addLine(to: CGPoint(x: centerViewWidth + 3, y: centerViewHeight - shadowGap))
path.addLine(to: CGPoint(x: centerViewWidth + 3, y: 0))
path.close()
centerView.layer.shadowPath = path.cgPath
centerView.layer.shadowColor = UIColor(red: 9.0 / 255.0, green: 152.0 / 255.0, blue: 255.0 / 255.0, alpha: 0.8).cgColor
centerView.layer.shadowOpacity = 0.8
centerView.layer.shadowRadius = 10
centerView.layer.shadowOffset = CGSize(width: 3, height: 0)

centerView.snp.makeConstraints { (make) in
make.leading.equalTo(15)
make.trailing.equalTo(-15)
make.top.equalToSuperview()
make.height.equalTo(centerViewHeight)
}
}

override func layoutSubviews() {
super.layoutSubviews()
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

func addViews(_ contentView: UIView) {
// just layout
addSubview(contentView)
contentView.snp.makeConstraints { (make) in
make.leading.trailing.equalTo(centerView)
make.top.equalTo(centerView)
make.bottom.equalTo(archCoverView)
}
}
}
52 changes: 52 additions & 0 deletions AtomeMerchantDemo/AtomeMerchantDemo/Home/HomeContentView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
//
// HomeContentView.swift
// AtomeMerchantDemo
//
// Created by boye on 2021/11/9.
// Copyright © 2021 boye. All rights reserved.
//

import UIKit

class HomeContentView: UIView {
var getStartCallback: (()->Void)?

private let descLabel = UILabel()
private let gettingStartButton = GradientButton(title: "Get start")

override init(frame: CGRect) {
super.init(frame: frame)
setupUI()
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

private func setupUI() {
descLabel.textAlignment = .center
descLabel.font = UIFont.boldSystemFont(ofSize: 15)
descLabel.textColor = UIColor.darkGray
descLabel.text = "Click the button below to start"
addSubview(descLabel)
descLabel.snp.makeConstraints { make in
make.top.equalToSuperview().offset(50)
make.leading.equalToSuperview().offset(15)
make.trailing.equalToSuperview().offset(-15)
}

addSubview(gettingStartButton)
gettingStartButton.layer.cornerRadius = GradientButton.buttonSize.height / 2
gettingStartButton.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.top.equalTo(descLabel.snp.bottom).offset(30)
make.size.equalTo(GradientButton.buttonSize)
}

gettingStartButton.addTarget(self, action: #selector(getStartAction), for: .touchUpInside)
}

@objc private func getStartAction() {
getStartCallback?()
}
}
88 changes: 88 additions & 0 deletions AtomeMerchantDemo/AtomeMerchantDemo/Home/HomeViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
//
// HomeViewController.swift
// AtomeMerchantDemo
//
// Created by boye on 2021/11/8.
// Copyright © 2021 boye. All rights reserved.
//

import UIKit
import SnapKit

class HomeViewController: UIViewController {
private let backgroundImageView = UIImageView()
private let bottomCoverView = UIView()
private let logoImageView = UIImageView()
private let scrollView = UIScrollView()
private let contentView = UIView()
private let coverView = HomeContentArchView()
private let homeContentView = HomeContentView()

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
navigationController?.navigationBar.setBackgroundImage(UIImage.init(), for: .default)
navigationController?.navigationBar.shadowImage = UIImage.init()
}

override func viewDidLoad() {
super.viewDidLoad()

setupUI()
setupAction()
}

private func setupUI() {
backgroundImageView.backgroundColor = UIColor.canary
view.addSubview(backgroundImageView)
backgroundImageView.snp.makeConstraints { (make) in
make.edges.equalToSuperview()
}

view.addSubview(bottomCoverView)
bottomCoverView.backgroundColor = UIColor.white
bottomCoverView.snp.makeConstraints { (make) in
make.trailing.leading.bottom.equalToSuperview()
make.height.equalTo(UIScreen.main.bounds.height / 2)
}

logoImageView.image = UIImage(named: "logoDark")
view.addSubview(logoImageView)
logoImageView.snp.makeConstraints { (make) in
make.top.equalTo(view.safeAreaLayoutGuide.snp.top).offset(38)
make.leading.equalToSuperview().offset(15)
make.width.equalTo(110)
make.height.equalTo(21)
}

view.addSubview(scrollView)
scrollView.showsVerticalScrollIndicator = false
scrollView.showsHorizontalScrollIndicator = false
scrollView.snp.makeConstraints { (make) in
make.leading.trailing.bottom.equalToSuperview()
make.top.equalTo(logoImageView.snp.bottom).offset(30)
}

scrollView.addSubview(contentView)
contentView.snp.makeConstraints { (make) in
make.leading.trailing.top.bottom.equalToSuperview()
make.width.equalToSuperview()
}

contentView.addSubview(coverView)
coverView.snp.makeConstraints { (make) in
make.top.leading.trailing.bottom.equalToSuperview()
make.width.equalToSuperview()
make.height.equalTo(HomeContentArchView.contentHeight)
}

coverView.addViews(homeContentView)
}

private func setupAction() {
homeContentView.getStartCallback = { [weak self] in
guard let self = self else { return }
let vc = ViewController()
self.navigationController?.pushViewController(vc, animated: true)
}
}
}
18 changes: 0 additions & 18 deletions AtomeMerchantDemo/AtomeMerchantDemo/HomeViewController.swift

This file was deleted.

4 changes: 0 additions & 4 deletions AtomeMerchantDemo/AtomeMerchantDemo/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,12 @@
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
<key>UISceneStoryboardFile</key>
<string>Main</string>
</dict>
</array>
</dict>
</dict>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
Expand Down
11 changes: 7 additions & 4 deletions AtomeMerchantDemo/AtomeMerchantDemo/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {


func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let _ = (scene as? UIWindowScene) else { return }
guard let windowScene = (scene as? UIWindowScene) else { return }

window = UIWindow(windowScene: windowScene)
let homeViewController = HomeViewController()
let rootViewController = UINavigationController(rootViewController: homeViewController)
window?.rootViewController = rootViewController
window?.makeKeyAndVisible()
}

func sceneDidDisconnect(_ scene: UIScene) {
Expand Down
Loading

0 comments on commit 791927d

Please sign in to comment.