Skip to content

Instantly share code, notes, and snippets.

@hehehaha0228
Created May 17, 2018 08:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hehehaha0228/02098c3d0beddfa130e0c3a82cf12691 to your computer and use it in GitHub Desktop.
Save hehehaha0228/02098c3d0beddfa130e0c3a82cf12691 to your computer and use it in GitHub Desktop.
import UIKit
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
@IBOutlet weak var tableView: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
print("A viewDidLoad")
}
override func viewWillAppear(_ animated: Bool) {
print("B viewWillAppear")
}
override func viewDidAppear(_ animated: Bool) {
print("C viewDidAppear")
}
override func viewWillDisappear(_ animated: Bool) {
print("D viewWillDisappear")
}
override func viewDidDisappear(_ animated: Bool) {
print("E viewDidDisappear")
}
func numberOfSections(in tableView: UITableView) -> Int {
print("numberOfSections 幾個section")
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
print("numberOfRowsInSection 每個section有幾個row")
return 3
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
cell.textLabel?.text = "xdasu"
print("cellForRowAt 建立cell內容")
return cell
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment