Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Hide Keyboard
- private var currentTextField: UITextField?
- func textFieldShouldReturn(_ textField: UITextField) -> Bool {
- textField.resignFirstResponder()
- return true
- }
- func textFieldDidBeginEditing(_ textField: UITextField) {
- currentTextField = textField
- }
- override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
- let touch = touches.first
- if touch?.view != mailField && touch?.view != nameField {
- self.view.endEditing(true)
- }
- }
- @IBAction func logoutAction(_ sender: Any) {
- resignField()
- }
- func resignField() {
- if let currentTextField = currentTextField {
- currentTextField.resignFirstResponder()
- }
- }
- // UiTextField corner redius & border
- mailField.layer.cornerRadius = 7
- mailField.layer.borderWidth = 1.8
- mailField.layer.borderColor = #colorLiteral(red: 0.8374180198, green: 0.8374378085, blue: 0.8374271393, alpha: 1).cgColor
- // Collection View , TableView Programmatically
- var framesCollectionView: UICollectionView!
- let layout = UICollectionViewFlowLayout()
- layout.scrollDirection = .horizontal
- if UIDevice.current.userInterfaceIdiom == .pad {
- fontSize = 17
- layout.minimumLineSpacing = 0
- layout.minimumInteritemSpacing = 0
- layout.sectionInset = UIEdgeInsets(top: 0, left: self.view.bounds.width / 3, bottom: 0, right: 100)
- layout.itemSize = CGSize(width: self.view.bounds.width / 11, height: temporaryCellCollectionHeight)
- } else if UIDevice.current.userInterfaceIdiom == .phone {
- fontSize = 12
- layout.minimumLineSpacing = 0
- layout.minimumInteritemSpacing = 0
- layout.itemSize = CGSize(width: self.view.bounds.width / 4, height: temporaryCellCollectionHeight)
- }
- framesCollectionView = UICollectionView(frame: .zero, collectionViewLayout: layout)
- framesCollectionView.dataSource = self
- framesCollectionView.delegate = self
- framesCollectionView.translatesAutoresizingMaskIntoConstraints = false
- framesCollectionView.showsHorizontalScrollIndicator = false
- framesCollectionView.backgroundColor = #colorLiteral(red: 0.1333333333, green: 0, blue: 0.2862745098, alpha: 1)
- framesCollectionView.register(CollageVideoFrameCell.self, forCellWithReuseIdentifier: "CollageVideoFrameCell")
- @objc func framesButPressed() {
- self.view.addSubview(framesCollectionView)
- let safeArea = self.view.safeAreaLayoutGuide
- framesCollectionView?.bottomAnchor.constraint(equalTo: safeArea.bottomAnchor, constant: -3).isActive = true
- framesCollectionView?.leadingAnchor.constraint(equalTo: safeArea.leadingAnchor, constant: 10).isActive = true
- framesCollectionView?.trailingAnchor.constraint(equalTo: safeArea.trailingAnchor, constant: -10).isActive = true
- framesCollectionView?.heightAnchor.constraint(equalToConstant: temporaryCellCollectionHeight).isActive = true
- framesCollectionView.reloadData()
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement