// so dong
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return mang.count ;
}
// giao dien moi dong
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell") as! DongTableViewCell
cell.lblDong.text = mang[indexPath.row].Ten
cell.imvdongHinh.image = UIImage( named: mang[indexPath.row].Hinh )
return cell
}
// su kien click vao item
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
print( indexPath.row )
let sb = UIStoryboard(name: "Main", bundle: nil)
let manhinh = sb.instantiateViewController(withIdentifier: "ManHinhChiTiet") as! ChiTietViewController
manhinh.hinh = mang[indexPath.row].Hinh
self.navigationController?.pushViewController(manhinh, animated: true)
}
Không có nhận xét nào:
Đăng nhận xét