//
Oneviewcontroller.swift
tab
//
Created by Su on 15/12/7.
Copyright©2015 year Tian. All rights reserved.
//
Import UIKit
Let ID = "cell"
Class Oneviewcontroller:uiviewcontroller,uitableviewdelegate, Uitableviewdatasource {
Let mytabelview:uitableview!
Override Func Viewdidload () {
Super.viewdidload ()
Self.view.backgroundColor = Uicolor.bluecolor ()
Self.navigationItem.title = "AA"
Create TableView
Let Tabelview = UITableView (Frame:view.bounds, Style:UITableViewStyle.Plain)
Register cell
Tabelview.registerclass (uitableviewcell.self, Forcellreuseidentifier:id)
And that's the way it's possible.
Tabelview.registerclass (Uitableviewcell.classforcoder (), Forcellreuseidentifier:id)
Set up agents and data sources
Tabelview.delegate = Self
Tabelview.datasource = Self
Tabelview.tablefooterview = UIView ()
Add to view
Self.view.addSubview (Tabelview)
}
Func TableView (Tableview:uitableview, Numberofrowsinsection section:int), Int {
Return 10
}
Func TableView (Tableview:uitableview, Cellforrowatindexpath indexpath:nsindexpath), UITableViewCell {
Let cell = Tableview.dequeuereusablecellwithidentifier (ID, Forindexpath:indexpath)
cell.textlabel!. Text = "False data"
return cell
}
Override Func didreceivememorywarning () {
Super.didreceivememorywarning ()
Dispose of any resources the can be recreated.
}
/*
MARK:-Navigation
In a storyboard-based application, you'll often want to do a little preparation before navigation
Override Func Prepareforsegue (Segue:uistoryboardsegue, sender:anyobject?) {
Get The new view controller using Segue.destinationviewcontroller.
Pass the selected object to the new view controller.
}
*/
}
Swift Learning Uitabelview----UITableViewCell