Search This Blog

Thứ Ba, 26 tháng 12, 2017

Áp sự kiện click cho 1 cell in IOS

 cell.didSelectNews = { (md:ModelNews) -> () in
                        (self.delegate?.CateViewController_Selected(modelSelected: [md]))!

                    }


// trong class cell 

open var didSelectNews: ((_ md: ModelNews ) -> ())?

func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
        
        if let mdGet = arrPost?[indexPath.item]  {
            let mdPost = mdGet as! ModelNews
            didSelectNews!(mdPost)
        }
}

Không có nhận xét nào:

Đăng nhận xét