SHARE
TWEET

Untitled

a guest Jul 23rd, 2019 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import UIKit
  2.  
  3. class StoreListMainViewController: UIViewController,UITableViewDelegate, UITableViewDataSource{
  4.  
  5. // TableView
  6.     @IBOutlet weak var tableView: UITableView!
  7.     var StoreLocation: [String] = []
  8.  
  9. //Loop for data from database
  10.                 var pStoreName = [String]()
  11.                 if let jsonResponsePlanDetail = jsonResponsePlanDetail{
  12.                     for dictionary in jsonResponsePlanDetail{
  13.                         pStoreName.append(dictionary["StoreShortName"]! as! String)
  14.                         print("pStoreName ==> (pStoreName)")
  15.                         self.StoreLocation = pStoreName
  16.                         print("StoreLocation ==> (self.StoreLocation)")
  17.                     }//for
  18.                 }//if
  19.  
  20.  
  21. //  TableView
  22.     func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  23.         return StoreLocation.count
  24.     }
  25.  
  26.     func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  27.         let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as? cellTableViewCell
  28.         cell!.Location.text = StoreLocation[indexPath.row]
  29.         cell!.DepartureTime.text = StoreLocation[indexPath.row]
  30.         return cell!
  31.     }
  32.  
  33. //go to detail viewController
  34.  
  35. }
  36.      
  37. //Cell
  38. import UIKit
  39.  
  40. class cellTableViewCell: UITableViewCell {
  41.  
  42.     @IBOutlet weak var Location: UILabel!
  43.     @IBOutlet weak var DepartureTime: UILabel!
  44.  
  45.     override func awakeFromNib() {
  46.         super.awakeFromNib()
  47.     }
  48.  
  49.     override func setSelected(_ selected: Bool, animated: Bool) {
  50.         super.setSelected(selected, animated: animated)
  51.     }
  52. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top