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
| // Set up tableview | |
| self.tableView.dataSource = self | |
| self.tableView.delegate = self | |
| self.tableView.rowHeight = UITableView.automaticDimension | |
| self.tableView.estimatedRowHeight = 45 |
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
| // MARK: - UIWebView delegate - | |
| func webView(_ webView: UIWebView, shouldStartLoadWith request: URLRequest, navigationType: UIWebViewNavigationType) -> Bool { | |
| return true | |
| } | |
| func webViewDidStartLoad(_ webView: UIWebView) { | |
| } |
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
| // MARK: - UITextViewDelegate - | |
| func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { | |
| if text == "\n" { | |
| textView.resignFirstResponder() | |
| return false | |
| } | |
| return true | |
| } |
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
| // MARK: - UITextFieldDelegate - | |
| func textFieldDidBeginEditing(_ textField: UITextField) { | |
| let screen_offset = (UIScreen.main.bounds.size.height - 330) - 60 // Gets offset based on screen size and keyboard / nav height | |
| let y = textField.frame.origin.y - screen_offset | |
| self.scrollView.setContentOffset(CGPoint(x: 0, y: y > 0 ? y : 0), animated: true) | |
| } | |
| func textFieldDidEndEditing(_ textField: UITextField) { | |
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
| // MARK: - UICollectionView Datasource and Delegate - | |
| func numberOfSections(in collectionView: UICollectionView) -> Int { | |
| return 1 | |
| } | |
| func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { | |
| // TODO: Implement count. |
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
| // MARK: - TableView delegate and datasource | |
| extension SomeClass: UITableViewDataSource, UITableViewDelegate { | |
| func numberOfSections(in tableView: UITableView) -> Int { | |
| // #warning Incomplete implementation, return the number of sections | |
| return 0 | |
| } | |
| func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | |
| // #warning Incomplete implementation, return the number of rows |
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
| // MARK: - UISearchBarDelegate - | |
| func searchBarSearchButtonClicked(_ searchBar: UISearchBar) { | |
| searchBar.resignFirstResponder() | |
| } | |
| func searchBarCancelButtonClicked(_ searchBar: UISearchBar) { | |
| self.filteredUsers = nil | |
| self.tableView.reloadData() | |
| searchBar.resignFirstResponder() |
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 fontFamilyNames = UIFont.familyNames | |
| for familyName in fontFamilyNames { | |
| print("------------------------------") | |
| print("Font Family Name = [\(familyName)]") | |
| let names = UIFont.fontNames(forFamilyName: familyName ) | |
| print("Font Names = [\(names)]") | |
| } |
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 prepare(for segue: UIStoryboardSegue, sender: Any?) { | |
| // Get the new view controller using segue.destinationViewController. | |
| // Pass the selected object to the new view controller. | |
| } |
OlderNewer