Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import UIKit
- class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
- @IBOutlet weak var tableView: UITableView!
- var items = ["Один", "Два", "Три", "Четыре", "Пять", "Шесть", "Семь", "Восемь", "Девять", "Десять"]
- override func viewDidLoad() {
- super.viewDidLoad()
- tableView.delegate = self
- tableView.dataSource = self
- }
- func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
- return items.count
- }
- func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
- var cell: MyTableViewCell = tableView.dequeueReusableCellWithIdentifier("Cell") as MyTableViewCell
- cell.cellLabel.text = items[indexPath.row]
- cell.cellImage.image = UIImage(named: "sample-886-ice-cream-cone@2x.png")
- return cell
- }
- override func didReceiveMemoryWarning() {
- super.didReceiveMemoryWarning()
- // Dispose of any resources that can be recreated.
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement