IOS 10 : TableView tutorial with Swift 3 – most easy way

import UIKit

class ViewController: UIViewController , UITableViewDelegate , UITableViewDataSource{

var names = ["arif","hasnat","ios","developer"]

@IBOutlet weak var tableView: UITableView!
override func viewDidLoad() {
super.viewDidLoad()

tableView.delegate = self
tableView.dataSource = self

}

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return names.count
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = UITableViewCell()
cell.textLabel?.text = names[indexPath.row]
return cell

}

}

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

Android Custom spinner .Android Custom spinner .

Step -1 : Create new Adapter . public class CustomSpinnerAdapter extends BaseAdapter implements SpinnerAdapter { private final Context context; private ArrayList<String> asr; public CustomSpinnerAdapter(Context context1, ArrayList<String> asr) { this.context =