UISlider
//
// SliderViewController.swift
// UIControlDemo
//
// Created by on 14/12/4.
// Copyright (c) 2014年 马大哈. All rights reserved.
//
import UIKit
class SliderViewController: BaseViewController {
var slider: UISlider?
override func viewDidLoad() {
super.viewDidLoad()
slider = UISlider(frame: CGRectMake(20, 400, self.view.frame.size.width-40, 50))
slider?.minimumValue = 1
slider?.maximumValue = 100
slider?.addTarget(self, action: "valueChanged:", forControlEvents: UIControlEvents.ValueChanged)
self.view.addSubview(slider!)
}
func valueChanged(sender:UISlider){
let value = "\(Int(sender.value))"
self.title = value
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}