[iOS] toast message - ๋ฐฐ๋ฌ์ ๋ฏผ์กฑ ์ฅ๋ฐ๊ตฌ๋์ ์ถ๊ฐ๋์ต๋๋ค
์ด๋ฒ ํ ํ๋ก์ ํธ๋ ํ๋์ ํ๋ฉด์์ ๊ฒฐ์ ๊น์ง ์ด๋ฃจ์ด์ง๋ ๊ณผ์ ์๋ค.
๊ณ ๋ฏผ์ ํ๋ค ์ฅ๋ฐ๊ตฌ๋ ํ์ด์ง๊ฐ ๋ฐ๋ก ๋ง๋ค ์๊ฐ ์์ด์ ํํ ๋ชจ๋ฌ์ ๋์ฐ๊ธฐ๋ก ํ๋ค.
๊ทธ๋ฌ๋ ๋ชจ๋ฌ์ ์ด๊ธฐ ์ ๊น์ง ์ฅ๋ฐ๊ตฌ๋์ ์ํ์ด ์ ๋๋ก ๋ด๊ฒผ๋์ง ํ์ธํ๊ธฐ๊ฐ ์ฝ์ง ์์๋ค.
๊ทธ๋์ ์ค์ ๋ก ๋ค๋ฅธ ์ฑ๋ค์ ์ด๋ค ๋ฐฉ์์ผ๋ก ๊ตฌํํ๋์ง ๋ค์ํ ์ดํ๋ค์ ๊น์๋ณด๊ณ ์ฐพ์๋ณด์๋ค.
(์ด๋ ๊ฒ ํ ์คํธํ๋ค ์ค์ ๋ก ์คํ๋ฒ ์ค ์ฌ์ด๋ ์ค๋ ์๋๊ฒฐ์ ๋ก ๋์ด๊ฐ์ ํธ๋ ํ ์ฌ์ด์ฆ ์์ด์คํฐ ๋งค์ฅ ํฝ์ ํ๊ฒ ๋๋ค๋ ์ฐ๊ณผ ํจ๊ป....โ)
๊ทธ์ค์์ ๋๋ ๋ฐฐ๋ฌ์ ๋ฏผ์กฑ์ ์ฅ๋ฐ๊ตฌ๋์ ๋ด๋ ๊ธฐ๋ฅ์ด ์ ํฉํด ๋ณด์๋ค.
๋ฐ๋ก ์ด ๊ธฐ๋ฅ์ด๋ค!!!
๊ทผ๋ฐ ๊ตฌํํ๊ณ ์ถ์๋ฐ ๋ญ๋ผ๊ณ ๊ฒ์ํด์ผํ ์ง ๊ฐ์กฐ์ฐจ ์ค์ง ์์๋ค...
๋ฐฐ๋ฌ์ ๋ฏผ์กฑ ์ฅ๋ฐ๊ตฌ๋ ๋ด๊ธธ ๋, ์ฅ๋ฐ๊ตฌ๋์ ๋ด๊ธฐ๋ ์ ๋๋ฉ์ด์ ๋ฑ๋ฑ
์ ๋ง ๋ค์ํ ๊ฒ์์ด๋ก ์ฐพ์๋ณด๊ณ ํํฐ๋๋ค๊ณผ ๋งค๋์ ๋๋ค๋ ์ฐพ์๊ฐ๋ณด์๋๋ฐ
ํํ ๋ด๊ฐ ๊ฐ ๋๋ง๋ค ์๋ฌด๋ ์ ๊ณ์ จ๋ค....
์๊ฐ์ด ๊ทธ๋ ๊ฒ ๋ง์ง ์๊ธฐ๋ ํ๊ณ , ์ ๋ง ๋๋ฌด๋๋ฌด๋๋ฌด ๊ถ๊ธํ๋ค...ใ ใ ใ ใ
๊ทธ๋์ iOS ๊ฐ๋ฐ์ ์คํ ์ฑํ ์ ์ฐพ์์ ์ง๋ฌธํ๋๋ฐ ์๊ฐ๋ณด๋ค ๊ธ๋ฐฉ
Toast Message๋ฅผ ์ ์ ์์๋คใ ใ ใ ใ
func showToast() {
let toastLabel = UILabel()
toastLabel.backgroundColor = UIColor.black.withAlphaComponent(0.7)
toastLabel.textColor = UIColor.white
toastLabel.font = UIFont.systemFont(ofSize: 17.0)
toastLabel.textAlignment = .center
toastLabel.text = "์ฅ๋ฐ๊ตฌ๋์ ๋ฉ๋ด๋ฅผ ์ถ๊ฐํ์ต๋๋ค"
toastLabel.alpha = 1.0
toastLabel.layer.cornerRadius = 7
toastLabel.clipsToBounds = true
self.view.addSubview(toastLabel)
UIView.animate(withDuration: 0.9, delay: 0.6, options: .curveEaseOut, animations: {
toastLabel.alpha = 0.0
}, completion: {(isCompleted) in
toastLabel.removeFromSuperview()
})
toastLabel.snp.makeConstraints {
$0.center.equalToSuperview()
$0.width.equalTo(280)
$0.height.equalTo(50)
}
}
๐ Reference
https://royhelen.tistory.com/46
[UIKit] ViewController ์๋ช ์ฃผ๊ธฐ(Life Cycle) (0) | 2024.07.10 |
---|---|
textField์ UIKeyboardType (0) | 2024.07.08 |
[iOS] Lottie ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ค์น๋ฐฉ๋ฒ - ๋ฐ์น์คํฌ๋ฆฐ ๋ง๋ค๊ธฐ_์ฝ๋๋ฒ ์ด์ค (0) | 2024.07.05 |
[UIKit] UITableView ์ฝ๋๋ฒ ์ด์ค ์ฌ์ฉ๋ฒ (0) | 2024.07.04 |
[UIKit] ํํ๋ชจ๋ฌ ๊ตฌํ(Scrollable Bottom Sheet) - SheetPresentationController (0) | 2024.07.03 |