-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from Nice-Duck/feature/custom_textfield
[#36]Feat: 커스텀 서치 바 구현
- Loading branch information
Showing
15 changed files
with
255 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// | ||
// SparkyTextField.swift | ||
// Sparky-iOS | ||
// | ||
// Created by SeungMin on 2022/10/18. | ||
// | ||
|
||
import UIKit | ||
|
||
class SparkyTextField: UITextField { | ||
|
||
override init(frame: CGRect) { | ||
super.init(frame: frame) | ||
|
||
// setupUI() | ||
setupUnderLine() | ||
} | ||
|
||
// required init?(coder: NSCoder) { | ||
// super.init(coder: coder) | ||
// | ||
// setupUnderLine() | ||
// } | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
// private func setupUI() { | ||
// $0. | ||
// | ||
// setupUnderLine() | ||
// } | ||
|
||
private func setupUnderLine() { | ||
let bottomLayer = CALayer() | ||
bottomLayer.frame = CGRect(x: 0, | ||
y: self.frame.height, | ||
width: self.frame.width, | ||
height: 1) | ||
bottomLayer.backgroundColor = UIColor.gray400.cgColor | ||
self.layer.addSublayer(bottomLayer) | ||
} | ||
|
||
func setupLeftImageView(image: UIImage) { | ||
self.leftViewMode = .always | ||
let leftImageView = UIImageView(frame: CGRect(x: 0, | ||
y: self.frame.height / 2 - 10, | ||
width: 16, | ||
height: 16)) | ||
leftImageView.tintColor = .gray400 | ||
leftImageView.image = image | ||
self.addSubview(leftImageView) | ||
} | ||
|
||
override func placeholderRect(forBounds bounds: CGRect) -> CGRect { | ||
let bounds = CGRect(x: 24, y: bounds.size.height / 2 - 10, width: bounds.width, height: bounds.height) | ||
return bounds | ||
} | ||
|
||
override func editingRect(forBounds bounds: CGRect) -> CGRect { | ||
let bounds = CGRect(x: 24, y: bounds.size.height / 2 - 10, width: bounds.width, height: bounds.height) | ||
return bounds | ||
} | ||
|
||
override func textRect(forBounds bounds: CGRect) -> CGRect { | ||
let bounds = CGRect(x: 24, y: bounds.size.height / 2 - 10, width: bounds.width, height: bounds.height) | ||
return bounds | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// | ||
// MyScrapVC.swift | ||
// Sparky-iOS | ||
// | ||
// Created by SeungMin on 2022/10/18. | ||
// | ||
|
||
import UIKit | ||
|
||
final class MyScrapVC: UIViewController { | ||
|
||
// MARK: - Properties | ||
|
||
|
||
// MARK: - LifeCycles | ||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
view.backgroundColor = .sparkyGreen | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
Sparky-iOS/SupprotingFiles/Assets.xcassets/Colors/background.colorset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"colors" : [ | ||
{ | ||
"color" : { | ||
"color-space" : "srgb", | ||
"components" : { | ||
"alpha" : "1.000", | ||
"blue" : "0.969", | ||
"green" : "0.976", | ||
"red" : "0.980" | ||
} | ||
}, | ||
"idiom" : "iphone" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Oops, something went wrong.