last day (14 days later) » 

12:17 PM
2
A: How to update each custom tableview cell data at the same time?

SubramanianOnce you update the data set with the new data. Reload the particular cells with the updated data set. func updateCellHeight(indexPath: IndexPath, comment: String) { DispatchQueue.main.async { let currentCellLyricVal = self.traduzioneArray[indexPath.row]["rics"] ...

 
JAK
But with this code the keyboard automatically dismissing every time when I am typing each letter.
 
Reloading the cell for every character change is not good practice. We can update the cells once you are done with the editing.
@JAK func textViewDidEndEditing(_ textView: UITextView) { self.delegate.updateCellHeight(indexPath: self.cellIndexPath, comment: textView.text) }
 
JAK
need to call self.delegate.updateCellHeight from both textViewDidEndEditing and textViewDidChange ?
 
No.. only textViewDidEndEditing
 
JAK
Its not working
Hi
subramanian
textViewDidEndEditing only call when user click on other cell on UITextview
Actually I want to grow two cells simultaneously when i am typing data on UITextview of first cell
 
12:33 PM
Hi..
 
JAK
hello
 
Okay.. Instead of reloading, can you take the cell object and perform cell.layoutIfNeeded()
if let visibleCellIndexPaths = tableView.indexPathsForVisibleRows {
if visibleCellIndexPaths.contains(updatedIndexPath) {
let existingCell = tableView.cellForRow(at: updatedIndexPath)
tableView.beginUpdates()
existingCell?.layoutIfNeeded()
tableView.endUpdates()
}
}
 
JAK
let me try this
 
JAK
12:54 PM
please go through the video i recorede
when I enter data to second last cell only growing,I want to grow last cell also
I tried the way you mentioned just above
It also not working
Here I cant attach the video
 
yeah
share the video url
 
JAK
which is the prefer source I can upload it?
 
drop box and share the public url.. else google drive
 
if your reload the cell, is that your keyboard dismissed?
 
JAK
yes
 
can you give me the cell creation code
 
JAK
You mean cellForRowAt method?
 
yes
 
JAK
1:20 PM
ok
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
 
it should not dismiss the keyboard, I am wondering why is that happening
are you dismissing the keyboard anywhere else
 
JAK
No..No...
please go through this qstn
12
Q: Change UITableView row height without dismissing keyboard

StefanI have a TextView inside a UITableViewCell. The text inside the TextView can be edited right there in place. The TextView grows and shrinks vertically depending on the number of lines the text contains. So far I haven't found a possibility to also let the row containing the TextView grow and shr...

everyone asks about keyboard dismissing issue while reload tableview
 
1:36 PM
let existingCell = tableView.cellForRow(at: updatedIndexPath)
tableView.beginUpdates()
cell.translateTextView.text = comment
existingCell?.layoutIfNeeded()
tableView.endUpdates()
update the cell label value and do layoutIfNeeded
if not works replace existingCell?.layoutIfNeeded() with existingCell?.setNeedsLayout()
 

last day (14 days later) »