Check UITableViewCell currently exists before tableview reloadRows刷新Cell前檢查Cell當下元件是否已生成

(UITableViewCell, cell exists)



Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (8) must be equal to the number of rows contained in that section before the update (0), plus or minus the number of rows inserted or deleted from that section (0 inserted, 0 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out). Table view: <UITableView: 0x7fbe698e8e00; frame = (0 20; 414 667); clipsToBounds = YES; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x6000006d2fa0>; layer = <CALayer: 0x600000947540>; contentOffset: {0, 0}; contentSize: {414, 0}; adjustedContentInset: {0, 0, 0, 0}; dataSource: <: 0x7fbe6c610580>>’


tableView.cellForRow(at: YOURINDEXPATH) != nil




學習 Swift iOS App 開發的學生作品集

Recommended from Medium

💋#NFTxCards is one of a kind platform that makes collecting experience exciting and responds to…

“This app has attempted to access privacy-sensitive data without a usage description” error…

Swift Notes on Navigation and Some

Build Pie Charts in SwiftUI

Firestore and SwiftUI?! Let’s do it!

SwiftUI: Choosing an Application Architecture

SwiftUI and the Intermittent EditMode

How to optimize the tracking process in iOS 14.5+

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Peggy Tsai 

Peggy Tsai 

iOS & Golang 隨手記 歡迎+Linkedin交流~

More from Medium

Set Up a Basic Bar Chart Using FLCharts (Swift)

FLCharts for iOS written in Swift

100 Days of SwiftUI Learning — Day 7

Adding GraphQL Schema file in Xcode project.

適合新手學習參考的 Swift iOS UIKit App 專案