简体   繁体   中英

UITableview Flickering in ios 11 while working correctly in iOS 10.2

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)


}

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM