UIKit/テーブル/基本
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
[[UIKit/テーブル]]
&tag(UIKit/テーブル/基本);
*目次 [#y19c908f]
#contents
*関連ページ [#p7b3b4be]
*参考情報 [#o9ac69a3]
*基礎: Single View ApplicationでUITableViewControllerから...
-Single View Applicationを生成。
-UITableViewControllerのサブクラスを追加(ex: MyTableViewC...
-Main.storyboardを開き、既存のView Controllerを削除。
-Table View Controllerをストーリーボードにドロップして追...
-そのクラスをMyTableViewControllerとする。
*UITableViewを使って実装(ストーリーボード) [#o41cfc7a]
-該当するViewControllerをデータソース、Delegate先とする場...
#pre{{
class ViewController: UIViewController, UITableViewDataSo...
@IBOutlet weak var tableView: UITableView!
var objects = ["まぐろ", "サーモン", "えび", "はまち"...
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view...
self.navigationItem.rightBarButtonItem = self.edi...
tableView.backgroundColor = UIColor.grayColor()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func tableView(tableView: UITableView, numberOfRowsIn...
return objects.count
}
func tableView(tableView: UITableView, cellForRowAtIn...
let cell = UITableViewCell(style: UITableViewCell...
cell.textLabel?.text = objects[indexPath.row]
cell.backgroundColor = UIColor.brownColor()
return cell
}
override func setEditing(editing: Bool, animated: Boo...
super.setEditing(editing, animated: animated)
tableView.setEditing(editing, animated: animated)
}
}
}}
終了行:
[[UIKit/テーブル]]
&tag(UIKit/テーブル/基本);
*目次 [#y19c908f]
#contents
*関連ページ [#p7b3b4be]
*参考情報 [#o9ac69a3]
*基礎: Single View ApplicationでUITableViewControllerから...
-Single View Applicationを生成。
-UITableViewControllerのサブクラスを追加(ex: MyTableViewC...
-Main.storyboardを開き、既存のView Controllerを削除。
-Table View Controllerをストーリーボードにドロップして追...
-そのクラスをMyTableViewControllerとする。
*UITableViewを使って実装(ストーリーボード) [#o41cfc7a]
-該当するViewControllerをデータソース、Delegate先とする場...
#pre{{
class ViewController: UIViewController, UITableViewDataSo...
@IBOutlet weak var tableView: UITableView!
var objects = ["まぐろ", "サーモン", "えび", "はまち"...
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view...
self.navigationItem.rightBarButtonItem = self.edi...
tableView.backgroundColor = UIColor.grayColor()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func tableView(tableView: UITableView, numberOfRowsIn...
return objects.count
}
func tableView(tableView: UITableView, cellForRowAtIn...
let cell = UITableViewCell(style: UITableViewCell...
cell.textLabel?.text = objects[indexPath.row]
cell.backgroundColor = UIColor.brownColor()
return cell
}
override func setEditing(editing: Bool, animated: Boo...
super.setEditing(editing, animated: animated)
tableView.setEditing(editing, animated: animated)
}
}
}}
ページ名: