0

I am trying to update my cell size when I click on particular cell.My table gets update perfectly in iOS 10.2 but my table flickers when I run my code on iOS 11 .I am also getting warning in iOS 11 that -[UIApplication application state] must be used from main thread. So, I have reload my table in dispatch queue but nothing happens. I have multi-level XIBs like I have cell in which I have a table which is registering another cell which expands on click. Below is my code sample when height expands my main table flicker.

func expandMessageTable(height : CGFloat,expendedRow:Int){

self.expandMessageHeight = height

self.msgExpRow = expendedRow

let row = cellMenuArr.index(of:"MessageXIB")

let path = IndexPath(row: row!, section: 0)
print(path)

homeTblView.reloadRows(at: [path], with: .fade)


}

1 Answers1

1

Below is the fine working code i am using to reload cells -

DispatchQueue.main.async(execute: {
                            UIView.performWithoutAnimation {
                                self.tableView?.beginUpdates()
                                let contentOffset = self.tableView?.contentOffset
                                self.tableView?.reloadRows(at: [IndexPath(row: j, section: 0)], with: .automatic)
                                self.tableView?.setContentOffset(contentOffset!, animated: false)
                                self.tableView?.endUpdates()
                            }
                        })

Hope it helps.

Pankaj
  • 397
  • 1
  • 3
  • 13