2
私のアプリではcollectionview
とbutton
が入っているカスタムセルを持つtableview
があります。私のアプリに拡張機能を実装したいのですが、コレクションビューのデータとボタンはクリックされていません。テーブルの高さを固定すると、コレクションビューとボタンがクリックされるようになりましたが、拡張高さを計算してクリックビューに割り当てません。拡張されたセルがクリックされていない
コード
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let cell = self.tableView.cellForRowAtIndexPath(indexPath) as! YourBudgetTableViewCell
cell.budgetIcon.image = UIImage(named: "ic_your_budget_close");
// cell.collectionView.tag = indexPath.row;
// cell.setCollectionViewDataSourceDelegate(self, forRow: indexPath.row)
cell.selected=true;
isCellSelected = indexPath.row;
self.tableView.beginUpdates();
self.tableView.endUpdates();
}
func tableView(tableView: UITableView, didDeselectRowAtIndexPath indexPath: NSIndexPath) {
let cell = self.tableView.cellForRowAtIndexPath(indexPath) as! YourBudgetTableViewCell
cell.budgetIcon.image = UIImage(named: "ic_your_budget_expand");
isCellSelected = -1;
self.tableView.beginUpdates();
self.tableView.endUpdates();
}
func tableView(tableView: UITableView, willSelectRowAtIndexPath indexPath: NSIndexPath) -> NSIndexPath? {
let selectedCell = tableView.cellForRowAtIndexPath(indexPath)!
if selectedCell.selected {
self.tableView.deselectRowAtIndexPath(indexPath, animated: false);
self.tableView(self.tableView, didDeselectRowAtIndexPath: indexPath)
return nil;
}
return indexPath
}
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
if isCellSelected == indexPath.row
{
return 200;
}
else
{
return 44;
}
// return 200;
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.listBudget.count
}
だから私は固定の高さを与える場合は、クリックが正常に動作しますが、与えられていない場合は、固定のクリックが費やされ、細胞またはセットのために高さ
また、私はコレクションビューのセルをクリックすることもできません。 –
セルclipToBoundsのプロパティをYESに設定し、ボタンがまだ見えるかどうか教えてください。 – Surjeet
まだクリックできません:( –