This file contains hidden or 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
| textLabel.layer.cornerRadius = 5 // 테두리에 라운드 넣기 <- 없으면 직사각형이나옴 | |
| textLabel.layer.borderWidth = 1 //테두리의 선 두께 | |
| textLabel.layer.borderColor = UIColor.black.cgColor //테두리 선 색깔 |
This file contains hidden or 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
| var lastKnowContentOfsset : CGFloat? | |
| // 현재 스크롤 위치와 lastKnowContentOfsset 와 비교해서 위인지 아래인지 확잉ㄴ | |
| func scrollViewDidScroll(_ scrollView: UIScrollView) { | |
| if scrollView == main_collection_view { | |
| let contentOffset = scrollView.contentOffset.y | |
| print("contentOffset: ", contentOffset) | |
| if let lastKnowContentOfsset = lastKnowContentOfsset { | |
| if contentOffset > lastKnowContentOfsset { | |
| print("scrolling Down") |
This file contains hidden or 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
| let imageView = UIImageView() | |
| imageView.contentMode = .scaleAspectFill | |
| imageView.image = UIImage(named: "example")?.withAlignmentRectInsets(UIEdgeInsets(top: -4, left: 0, bottom: -4, right: 0)) |
This file contains hidden or 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
| switch.tintColor = .grey // the "off" color | |
| switch.onTintColor = .black // //스위치가 온일때 뒷 배경색깔 '기본색 : 초록색) |
This file contains hidden or 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
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow(sender:)), name: UIResponder.keyboardWillShowNotification, object: nil) | |
| NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide(sender:)), name: UIResponder.keyboardWillHideNotification, object: nil) | |
| } | |
| @objc func keyboardWillShow(sender: NSNotification) { | |
| self.view.frame.origin.y = -150 // Move view 150 points upward | |
| } |
This file contains hidden or 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
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| self.tabBarController?.tabBar.isHidden = true | |
| self.tabBarController?.tabBar.isTranslucent = true // <- 이코드가 꼭 있어야함 | |
| } | |
| //다른 뷰에서 tabBar를 다시 보이게 하고 싶으면(viewWillAppear)에 false를 해주자 | |
| override func viewWillAppear(_ animated: Bool) { | |
| super.viewWillAppear(animated) | |
| self.tabBarController?.tabBar.isHidden = false |
This file contains hidden or 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
| extension UITextField { | |
| func setPadding(left: CGFloat? = nil, right: CGFloat? = nil){ | |
| if let left = left { | |
| let paddingView = UIView(frame: CGRect(x: 0, y: 0, width: left, height: self.frame.size.height)) | |
| self.leftView = paddingView | |
| self.leftViewMode = .always | |
| } | |
| if let right = right { |