Skip to content

Instantly share code, notes, and snippets.

@akjesto
Last active June 13, 2017 08:21
Show Gist options
  • Save akjesto/80f6259f83607a701eac57d83a16a2ec to your computer and use it in GitHub Desktop.
Save akjesto/80f6259f83607a701eac57d83a16a2ec to your computer and use it in GitHub Desktop.
extension ViewController: ExpandingCellDelegate {
func didChange(indexPath: IndexPath, comment: String) {
for index in tempIndexArray {
self.traduzioneArray[index]["ione"] = comment
}
self.lyricsTableView.reloadData()
}
func beginEdit(indexPath: IndexPath) {
self.lyricsTableView.scrollToRow(at: indexPath, at: .top, animated: true)
let currentCellLyricVal = self.traduzioneArray[indexPath.row]["rics"]
for (index,element) in traduzioneArray.enumerated() {
let lyricVal = element["rics"]
if currentCellLyricVal == lyricVal {
tempIndexArray.append(index)
}
}
}
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell{
let cell: TranslateTableViewCell = tableView.dequeueReusableCell(withIdentifier: "TranslateTableViewCell", for: indexPath as IndexPath) as! TranslateTableViewCell
if let traduzioneVal = self.traduzioneArray[indexPath.row]["ione"] {
cell.translateTextView.text = traduzioneVal
}
if let lyricsVal = self.traduzioneArray[indexPath.row]["rics"] {
cell.originalLabel.text = lyricsVal
}
cell.cellIndexPath = indexPath
cell.delegate = self
return cell
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment