Created
May 12, 2015 04:04
-
-
Save delboy1978uk/1633d6ef13401202ad4a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class ViewController: UIViewController, UITableViewDelegate | |
{ | |
@IBOutlet weak var number: UILabel! | |
@IBOutlet weak var slider_value: UISlider! | |
@IBOutlet weak var table: UITableView! | |
@IBAction func sliderMoved(sender: AnyObject) | |
{ | |
var val = Int(slider_value.value) | |
number.text = "\(val)" | |
table.reloadData() | |
} | |
override func viewDidLoad() | |
{ | |
super.viewDidLoad() | |
} | |
override func didReceiveMemoryWarning() { | |
super.didReceiveMemoryWarning() | |
// Dispose of any resources that can be recreated. | |
} | |
func getValue() -> String | |
{ | |
return "\(Int(slider_value.value))" | |
} | |
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int | |
{ | |
return 12; | |
} | |
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell | |
{ | |
var cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "cell") | |
var val = Int(slider_value.value) * (indexPath.item + 1) | |
cell.textLabel?.text = "\(val)" | |
return cell | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment