2
在我的应用程序中,我有一个tableview
与自定义单元格,其中包含一个collectionview
和button
其中。我想在我的应用程序中实现扩展功能。问题是,当展开一个特定的单元格时, collectionview数据和按钮不被点击。我发现,当我固定表的高度,我的collectionview和按钮被点击,但是当我计算扩展的高度,并将其分配给当时的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
}
所以,如果我给固定的高度说200 heightForRowAtIndexPath点击工作正常,但如果不给固定的点击是不工作
我可以看到按钮也不能单击collectionview单元也 –
设置属性到您的单元clipToBounds为YES,让我知道你是否仍然可以看到按钮。 – Surjeet
nah仍然不能点击:( –