简体   繁体   中英

Why doesn't delegate/datasource show in IB?

I have a uiviewcontroller declared like this:

@interface RootViewController : UIViewController<UITableViewDelegate, UITableViewDataSource>

I've dragged a tableview onto the rootcontroller's view. When clicking the File's Owner, all I see is tableview. Where is the delegate and datasource, which need to be connected for the tableview to work?

The datasource and delegate items in IB are visible when you have your UITableView selected. Don't click the File's Owner, click the table view.

delegate and datasource are properties on the tableview, not on the "File's Owner", which is the UIViewController. So you need to do it in the other direction, look at the outlets on the tableview and connect those to the view controller.

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