2016-12-12 4 views
0

私はTableViewを持っており、そのUITableViewCellには私はUICollectionViewを持っています。 自分のコレクションビューにあります。各コレクションビューセルには、セルの作成とセルの削除ボタンオプションがあります。だから私はCreateViewControllerのために行く必要があり、私はそれぞれのcollectionViewCellを削除する必要があります削除ボタンのためのセルを作成する。次へ進むコレクションを使用して表示セルを表示しますか?

私didSelectRow方法で今
import UIKit 

class TableCollectionCell: UITableViewCell { 

@IBOutlet weak var collectionView: UICollectionView! 

override func awakeFromNib() { 
    super.awakeFromNib() 

    //collectionView cell 
    collectionView!.register(UINib(nibName: "CreateGroupCell", bundle: nil), forCellWithReuseIdentifier: "CreateGroupCell") 
} 

override func setSelected(_ selected: Bool, animated: Bool) { 
    super.setSelected(selected, animated: animated) 

} 
} 

//Collection View 
extension TableCollectionCell : UICollectionViewDataSource ,UICollectionViewDelegateFlowLayout 
{ 
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int 
{ 
    return 4 
} 

func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell 
{ 
    let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "CreateGroupCell", for: indexPath) as! CreateGroupCell 

    cell.groupName.text = "" 
    CreateCardView(viewCorner: cell.cardView) 

    if(0 == indexPath.row) 
    { 
     //cell.btnDotted.tag = indexPath.row 
     //cell.btnShare.tag = indexPath.row 
     cell.btnDotted.setImage(UIImage(named: "Info"), for: UIControlState.normal) 
     cell.btnShare.setImage(UIImage(named : "AddGroup"), for: UIControlState.normal) 
    } 

    else if(indexPath.row >= 1 && indexPath.row <= 3) 
    { 
     cell.btnDotted.isHidden = true 
     cell.btnShare.isHidden = true 
     cell.groupImage.image = UIImage(named: "group_dull_card.png") 
    } 

    else 
    { 

    } 

    return cell 
} 


func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { 

    if (0 == indexPath.row) { 


    } 
} 

func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { 

    return CGSize(width: 200, height: 150) 
} 
} 

(indexPath.row == 0)、私はCreateViewControllerのために行く必要があれば。

どうすればいいですか?私はデリゲートでも新しいです。

答えて

0

didSelectRow方法

 if ( indexPath.row == 0) 
     { 
    self.storyboard?.instantiateViewControllerWithIdentifier("CreateViewControllerid") as! CreateViewController. 
    self.navigationController?.pushViewController(secondViewController, animated: true) 

     } 
+0

質問をお読みください。 これは私のtableViewCellクラスです。 ありがとう – kishor0011

関連する問題