Skip to content

Commit

Permalink
Update CustomSwitch.swift
Browse files Browse the repository at this point in the history
No need for a circular view to hold the "or" label.
  • Loading branch information
MikePT28 committed Apr 2, 2015
1 parent a622b73 commit e2dfe83
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions Custom Switch/CustomSwitch.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class CustomSwitch: UIView {
var onButton: UIButton!
var offButton: UIButton!
var buttonWindow: UIView!
var centerCircle: UIView!

var onLabelActive: UILabel!
var onLabelInactive: UILabel!
Expand Down Expand Up @@ -95,20 +94,16 @@ class CustomSwitch: UIView {
offLabelInactive.font = UIFont(name: "AvenirNext-Demibold", size: 15.0)
offButton.addSubview(offLabelInactive)


centerCircle = UIView()
centerCircle.frame = CGRectMake((self.bounds.size.width / 2) - 12.0, (self.bounds.size.height / 2) - 12.0, 24.0, 24.0)
centerCircle.backgroundColor = UIColor(red:0.97, green:0.97, blue:0.97, alpha:1)
centerCircle.layer.cornerRadius = 12.0
self.addSubview(centerCircle)

centerCircleLabel = UILabel()
centerCircleLabel.frame = CGRectMake(0.0, 0.0, 24.0, 24.0)
centerCircleLabel.frame = CGRectMake((self.bounds.size.width / 2) - 12.0, (self.bounds.size.height / 2) - 12.0, 24.0, 24.0)
centerCircleLabel.text = "or"
centerCircleLabel.textAlignment = NSTextAlignment.Center
centerCircleLabel.textColor = UIColor(red:0.49, green:0.49, blue:0.49, alpha:1)
centerCircleLabel.font = UIFont(name: "AvenirNext-Regular", size: 11.0)
centerCircle.addSubview(centerCircleLabel)
centerCircleLabel.backgroundColor = UIColor(red:0.97, green:0.97, blue:0.97, alpha:1)
centerCircleLabel.layer.cornerRadius = 12.0
centerCircleLabel.clipsToBounds = true
self.addSubview(centerCircleLabel)

isOff = false

Expand Down

0 comments on commit e2dfe83

Please sign in to comment.