Last active
June 13, 2017 08:21
-
-
Save akjesto/80f6259f83607a701eac57d83a16a2ec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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