Răsfoiți Sursa

New View More

Marino Faggiana 8 ani în urmă
părinte
comite
63ef7bb72c
2 a modificat fișierele cu 46 adăugiri și 3 ștergeri
  1. 42 2
      iOSClient/Main/CCMore.swift
  2. 4 1
      iOSClient/Main/Main.storyboard

+ 42 - 2
iOSClient/Main/CCMore.swift

@@ -24,14 +24,54 @@
 
 import UIKit
 
-class CCMore: UIViewController, UITableViewDelegate {
+class CCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
 
+    @IBOutlet var tableView: UITableView!
 
+    let section = ["pizza", "deep dish pizza", "calzone"]
+    let items = [["Margarita", "BBQ Chicken", "Pepperoni"], ["sausage", "meat lovers", "veggie lovers"], ["sausage", "chicken pesto", "prawns", "mushrooms"]]
+    
+    override func viewDidLoad() {
+        
+        super.viewDidLoad()
+        
+        // This view controller itself will provide the delegate methods and row data for the table view.
+        tableView.delegate = self
+        tableView.dataSource = self
+    }
+    
+
+    func numberOfSections(in tableView: UITableView) -> Int {
+        return self.section.count
+    }
+    
+    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+        return self.items[section].count
+    }
+    
+    // create a cell for each table view row
+    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
+        
+        let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as! CCCellMore
+        
+        // cell.textLabel?.text = "Section \(indexPath.section) Row \(indexPath.row)"
+        //let fruitName = fruits[indexPath.row]
+        //cell.textLabel?.text = fruitName
+        //cell.detailTextLabel?.text = "Delicious!"
+        //cell.imageView?.image = UIImage(named: fruitName)
+        
+        return cell
+    }
+
+    
+    // method to run when table view cell is tapped
+    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
+        print("You tapped cell number \(indexPath.row).")
+    }
 }
 
 class CCCellMore: UITableViewCell {
     
     @IBOutlet weak var labelText: UILabel!
     @IBOutlet weak var imageIcon: UIImageView!
-    
 }

+ 4 - 1
iOSClient/Main/Main.storyboard

@@ -137,10 +137,13 @@
                             <constraint firstItem="cxb-Vw-8zb" firstAttribute="leading" secondItem="XtC-Je-LUc" secondAttribute="leading" id="qyg-dI-shE"/>
                         </constraints>
                     </view>
+                    <connections>
+                        <outlet property="tableView" destination="Xym-IM-aqh" id="BM5-cf-ZtQ"/>
+                    </connections>
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="D6O-WR-IEL" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
-            <point key="canvasLocation" x="9670" y="1218"/>
+            <point key="canvasLocation" x="9874" y="1218"/>
         </scene>
         <!--Offline Container-->
         <scene sceneID="AYB-62-j4s">