Programming/Swift

tableView 기본적으로 꼭 들어가야할 메소드.

ilovecoffee 2015. 5. 4. 20:05

    func numberOfSectionsInTableView(tableView: UITableView) -> Int {

        // #warning Potentially incomplete method implementation.

        // Return the number of sections.

        return 1

    }

    

    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {

        // #warning Incomplete method implementation.

        // Return the number of rows in the section.

        return shop.count

    }

    

    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

        let cell : DesignerResViewCell = tableView.dequeueReusableCellWithIdentifier("DesignerResViewCell") as! DesignerResViewCell

        


        cell.designerLabel.text = shop[indexPath.row]

        cell.addressLabel.text = shop[indexPath.row]

        cell.homeLabel.text = shop[indexPath.row]

        cell.reserLabel.text = shop[indexPath.row]

        cell.favLabel.text = shop[indexPath.row]



        

        return cell

    }

    

    func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {

        return 94.0

    }

    

    func tableView(tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {

        return 0.001

    }

    func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {

        let storyboard = UIStoryboard(name: "Main", bundle: nil)

        let managerViewController = storyboard.instantiateViewControllerWithIdentifier("ResDesignerInfoViewController") as! ResDesignerInfoViewController        

        parentNavigationController?.pushViewController(managerViewController, animated: true)

        

//        parentNavigationController!.pushViewController(MoreShopViewController(), animated: true)

        println("탔나")

    }