Created
May 17, 2018 08:59
-
-
Save hehehaha0228/02098c3d0beddfa130e0c3a82cf12691 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, 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