GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Help/Help/Features/CustomView.swift at master · lgreydev/Help Expand file tree/ Copy pathCustomView.swiftMore file actions 49 lines (39 loc) · 1.66 KB / Copy pathCustomView.swiftFile metadata and controls49 lines (39 loc) · 1.66 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 // // CustomView.swift // Help // // Created by Sergey Lukaschuk on 23.07.2021. // import UIKit /// Article /// https://medium.com/@umairhassanbaig/ios-swift-creating-a-custom-view-with-xib-ace878cd41c5 class PersonView: UIView { @IBOutlet var contentView: UIView! @IBOutlet var firstNameLabel: UILabel! @IBOutlet var lastNameLabel: UILabel! let contentXibName = "PersonView" override init(frame: CGRect) { super.init(frame: frame) commonInit() } required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) commonInit() } func commonInit() { Bundle.main.loadNibNamed(contentXibName, owner: self, options: nil) contentView.fixInView(self) } } extension UIView { func fixInView(_ container: UIView!) -> Void{ self.translatesAutoresizingMaskIntoConstraints = false; self.frame = container.frame; container.addSubview(self); NSLayoutConstraint(item: self, attribute: .leading, relatedBy: .equal, toItem: container, attribute: .leading, multiplier: 1.0, constant: 0).isActive = true NSLayoutConstraint(item: self, attribute: .trailing, relatedBy: .equal, toItem: container, attribute: .trailing, multiplier: 1.0, constant: 0).isActive = true NSLayoutConstraint(item: self, attribute: .top, relatedBy: .equal, toItem: container, attribute: .top, multiplier: 1.0, constant: 0).isActive = true NSLayoutConstraint(item: self, attribute: .bottom, relatedBy: .equal, toItem: container, attribute: .bottom, multiplier: 1.0, constant: 0).isActive = true } } |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |