func addUnderline(toTextField textField: DefaultTextField) {
textField.borderStyle = UITextBorderStyle.none;
let border = CALayer()
let borderWidth = CGFloat(1.0)
border.borderColor = UIColor(red: 91/255.0, green: 92/255.0, blue: 93/255.0, alpha: 1).cgColor
border.frame = CGRect(x: 0, y: textField.frame.size.height - borderWidth, width: textField.frame.size.width, height: textField.frame.size.height)
border.borderWidth = borderWidth
textField.layer.addSublayer(border)
textField.layer.masksToBounds = true
}
jueves, 26 de enero de 2017
miércoles, 4 de enero de 2017
iOS: Constants / Enums
enum StringEnum: String
{
case one = "one"
case two = "two"
case three = "three"
}
let anEnum = StringEnum(rawValue: "one")!
print("anEnum = \"\(anEnum.rawValue)\"")
{
case one = "one"
case two = "two"
case three = "three"
}
let anEnum = StringEnum(rawValue: "one")!
print("anEnum = \"\(anEnum.rawValue)\"")
iOS: Add views to stackview programmatically
let title = DefaultLabel()
title.text = "Date Available"
title.textAlignment = NSTextAlignment.left
view.containerStackView.insertArrangedSubview(title, at: 14)
title.leadingAnchor.constraint(equalTo: view.containerStackView.layoutMarginsGuide.leadingAnchor, constant: 16).isActive = true
title.trailingAnchor.constraint(equalTo: view.containerStackView.layoutMarginsGuide.trailingAnchor, constant: -16).isActive = true
title.text = "Date Available"
title.textAlignment = NSTextAlignment.left
view.containerStackView.insertArrangedSubview(title, at: 14)
title.leadingAnchor.constraint(equalTo: view.containerStackView.layoutMarginsGuide.leadingAnchor, constant: 16).isActive = true
title.trailingAnchor.constraint(equalTo: view.containerStackView.layoutMarginsGuide.trailingAnchor, constant: -16).isActive = true
Suscribirse a:
Entradas (Atom)