프로그램/iOS

[ iOS 9.x -> iOS 10 ] dequeueReusableCellWithIdentifier, dequeueReusableCell

로드러너 2016. 11. 29. 22:22

UITableView 에서 dequeueReusableCellWithIdentifier 함수를 통해서 데이터를 다시 불러와 cell 화면을 구성합니다. 

iOS 10에서는 사용법이 다음과 같이 바뀌었습니다.



 iOS 9.x 

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

        let cell = self.tableView.dequeueReusableCellWithIdentifier("AttractionTableCell", forIndexPath: indexPath) asAttractionTableViewCell


        return cell

    }



 iOS 10 

    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

        let cell = tableView.dequeueReusableCell(withIdentifier: "AttractionTableCell", for: indexPath) as! AttractionTableViewCell


        return cell

    }