@@ -25,8 +25,31 @@ class GMStepper: UIView {
25 leftButton.addTarget(self, action: "leftButtonTapped:", forControlEvents: .TouchDown)
25 leftButton.addTarget(self, action: "leftButtonTapped:", forControlEvents: .TouchDown)
26 rightButton.addTarget(self, action: "rightButtonTapped:", forControlEvents: .TouchDown)
26 rightButton.addTarget(self, action: "rightButtonTapped:", forControlEvents: .TouchDown)
28+ label.textAlignment = .Center
28 addSubview(leftButton)
30 addSubview(leftButton)
29 addSubview(rightButton)
31 addSubview(rightButton)
30 addSubview(label)
32 addSubview(label)
35+ override func layoutSubviews() {
36+ let buttonSize = Int(frame.size.height)
37+ let labelWidth = Int(frame.size.width) - 2 * buttonSize
39+ let leftButtonFrame = CGRect(x: 0, y: 0, width: buttonSize, height: buttonSize)
40+ let labelFrame = CGRect(x: buttonSize, y: 0, width: labelWidth, height: buttonSize)
41+ let rightButtonFrame = CGRect(x: buttonSize + labelWidth, y: 0, width: buttonSize, height: buttonSize)
43+ leftButton.frame = leftButtonFrame
44+ label.frame = labelFrame
45+ rightButton.frame = rightButtonFrame
48+ func leftButtonTapped(button: UIButton) {
52+ func rightButtonTapped(button: UIButton) {