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
| import UIKit | |
| class InterctiveLabel: UILabel { | |
| override var canBecomeFirstResponder: Bool { | |
| return true | |
| } | |
| override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool { | |
| self.backgroundColor = UIColor(hex: "EEEEEE") |
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
| class ViewController: UIViewController { | |
| @IBOutlet weak var tableView: UITableView! | |
| @IBOutlet weak var heightTableView: NSLayoutConstraint! | |
| override func viewWillAppear(_ animated: Bool) { | |
| super.viewWillAppear(animated) | |
| tableView.addObserver(self, | |
| forKeyPath: "contentSize", | |
| options: .new, | |
| context: nil) |
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 UIColor { | |
| convenience init(hex: String) { | |
| let scanner = Scanner(string: hex) | |
| scanner.scanLocation = 0 | |
| var rgbValue: UInt64 = 0 | |
| scanner.scanHexInt64(&rgbValue) | |
| let r = (rgbValue & 0xff0000) >> 16 |
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
| NSArray* reversedArray = [[startArray reverseObjectEnumerator] allObjects]; |
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
| import UIKit | |
| extension UIScrollView { | |
| func scrollToView(view:UIView, animated: Bool, navigationHeight: CGFloat?) { | |
| let childStartPoint = view.frame.origin | |
| let height = (navigationHeight ?? 0) * 2 + 16 | |
| self.scrollRectToVisible( | |
| CGRect(x: 0, | |
| y: childStartPoint.y - height, | |
| width: 1, |
NewerOlder