Kosty_Fomin

Untitled

Oct 24th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 1.49 KB | None | 0 0
  1. //
  2. //  SingleHotelTableViewController.swift
  3. //  CleverPumpkinTest
  4. //
  5. //  Created by Константин Фомин on 13.07.2018.
  6. //  Copyright © 2018 Константин. All rights reserved.
  7. //
  8.  
  9. import UIKit
  10.  
  11. class SingleHotelTableViewController: UITableViewController {
  12.    
  13.     var id : Int?
  14.  
  15.     override func viewDidLoad() {
  16.         super.viewDidLoad()
  17.         tableView.separatorStyle = .none
  18.     }
  19.  
  20.     override func didReceiveMemoryWarning() {
  21.         super.didReceiveMemoryWarning()
  22.     }
  23.  
  24.     override func numberOfSections(in tableView: UITableView) -> Int {
  25.         return 1
  26.     }
  27.  
  28.     override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  29.         return 1
  30.     }
  31.  
  32.    
  33.     override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  34.         let cell = tableView.dequeueReusableCell(withIdentifier: "singleHotelCell", for: indexPath) as! SingleHotelTableViewCell
  35.         cell.initializing(idOfHotel: id!)
  36.         return cell
  37.     }
  38.    
  39.     override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
  40.        
  41.         if let destinationHotelViewController = segue.destination as? HotelOnMapViewController {
  42.            
  43.             let indexPath = IndexPath(row: 0, section: 0)
  44.             let cell = tableView.cellForRow(at: indexPath) as! SingleHotelTableViewCell
  45.             destinationHotelViewController.hotel = cell.hotel
  46.            
  47.         }
  48.     }
  49.    
  50.    
  51. }
Advertisement
Add Comment
Please, Sign In to add comment