简体   繁体   中英

UITableView delegate methods being called before viewDidLoad

I have a view controller that subclasses UITableViewController. When I push this VC onto the navigation stack, the UITableView delegate methods get called, then viewDidLoad gets called, then the delegate methods get called again. What is going on here?

Because your view is a subclass of UITableViewController, the delegate and datasource are attached from the very first moment it's created, and the methods are called as soon as the datasource is asigned.

Also, you can set a breakpoint on it and see which class called the datasource.

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