Created
October 7, 2017 22:11
-
-
Save farhan-syed/6767c9a260762178d050b1ab1dfe1d88 to your computer and use it in GitHub Desktop.
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 BSPopupView: UIView { | |
override init(frame: CGRect) { | |
super.init(frame: frame) | |
setup() | |
} | |
required init?(coder aDecoder: NSCoder) { | |
fatalError("init(coder:) has not been implemented") | |
} | |
let alertDescription: UITextView = { | |
let textView = UITextView() | |
textView.textColor = .black | |
textView.text = "dfjklajdfldjasoifjlkajsofjdlsajklfdsdfjklajdfldjasoifjlkajsofjdlsajklfdsdfjklajdfldjasoifjlkajsofjdlsajklfdsdfjklajdfldjasoifjlkajsofjdlsajklfds" | |
textView.translatesAutoresizingMaskIntoConstraints = false | |
return textView | |
}() | |
func setup(){ | |
backgroundColor = .white | |
topAnchor.constraint(equalTo: topAnchor, constant: 15).isActive = true | |
leftAnchor.constraint(equalTo: leftAnchor, constant: 15).isActive = true | |
addSubview(alertDescription) | |
alertDescription.topAnchor.constraint(equalTo: topAnchor, constant: 0).isActive = true | |
alertDescription.leftAnchor.constraint(equalTo: leftAnchor, constant: 0).isActive = true | |
alertDescription.heightAnchor.constraint(equalToConstant: self.frame.height).isActive = true | |
alertDescription.widthAnchor.constraint(equalToConstant: self.frame.width).isActive = true | |
} | |
func dismiss(){ | |
removeFromSuperview() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment