Skip to content

Instantly share code, notes, and snippets.

@hanfengs
Last active January 14, 2022 08:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hanfengs/72a24d37018fd44c32837064ee009f51 to your computer and use it in GitHub Desktop.
Save hanfengs/72a24d37018fd44c32837064ee009f51 to your computer and use it in GitHub Desktop.
[文字描边] #swift
//https://www.jianshu.com/p/5c3883bdfd7e
let startLabel = UICreateTools.createLabel(frame: .zero, text: "string_start".localization, font: UIFont.mainFont(size: 12, weight: .heavy), textColor: .white, alignment: .right)
// startLabel.addBorder(1, color: UIColor(red: 62, green: 0, blue: 255))
self.view.addSubview(startLabel)
startLabel.snp.makeConstraints { make in
make.centerY.equalTo(startDate24Button)
make.trailing.equalTo(startDate24Button.snp.leading).offset(-4)
}
let startButton = UIButton(type: .custom)
startButton.layer.cornerRadius = 12
startButton.layer.masksToBounds = true
startButton.layer.borderWidth = 2
startButton.layer.borderColor = UIColor(red: 62, green: 0, blue: 255).cgColor
startButton.backgroundColor = UIColor(red: 0, green: 248, blue: 155)
startButton.addTarget(self, action: #selector(startDateButtonClick(_ :)), for: .touchUpInside)
self.view.insertSubview(startButton, belowSubview: startDate24Button)
startButton.snp.makeConstraints { make in
make.centerY.equalTo(startDate24Button)
make.trailing.equalTo(startDate24Button).offset(8)
make.leading.equalTo(startLabel).offset(-8)
make.height.equalTo(28)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment