开发者

Why doesn't delegate/datasource show in IB?

开发者 https://www.devze.com 2022-12-12 19:47 出处:网络
I have a uiviewcontroller declared like this: @interface RootViewController : UIViewController<UITableViewDelegate, UITableViewDataSource>

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开发者_如何学JAVA, 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消