1
私は他の答えを見回しましたが、何か動作するように見えません。私はこのコードを実装しました:セルが選択されているとき、セルの高さを変更するにはどうすればよいですか?
var selectedCellIndexPath: NSIndexPath?
let selectedCellHeight: CGFloat = 88.0
let unselectedCellHeight: CGFloat = 51.0
// Override to support editing of individual itemCells
override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
if selectedCellHeight == indexPath {
return selectedCellHeight
}
return unselectedCellHeight
}
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
if selectedCellIndexPath != nil && selectedCellIndexPath == indexPath {
self.selectedCellIndexPath = nil
} else {
self.selectedCellIndexPath = indexPath
}
tableView.beginUpdates()
tableView.endUpdates()
if selectedCellIndexPath != nil {
// THis ensure, that the cell is full visile once expended
tableView.scrollToRowAtIndexPath(indexPath, atScrollPosition: .None, animated: true)
}
}
を私は他のStackOverflow答えからそれを得たが、私は自分のアプリケーションを実行すると、セルのみ(網掛けされて)、それが選択されていることを示し、その後、他のアクションを実行しません。どんな助けも素晴らしいでしょう!私は最初の開発者です!
する必要があり、@Aaron Bragerをありがとう!私はまだ初心者ですので、これは私には見えないほど簡単でした!私は本当に助けに感謝します。 – KeithFrazier98
@ KeithFrazier98助けて嬉しいです!これで問題が解決した場合は、私の答えの左側にあるチェックボックスをクリックしてください。 (これは、他のユーザーにヘルプが不要になったことを伝えます)。 –