UITableView delegate and dataSource methods not getting called

后端 未结 8 1421
野性不改
野性不改 2021-02-13 14:23

I have a UIView which contains a UITableView. The tableview\'s delegate is set to my UIView, but it never calls the delegate methods:

-(id)init {
    self = [sup         


        
8条回答
  •  無奈伤痛
    2021-02-13 15:14

    You do not need to use a UIViewController, that's just a smokescreen. You also do not need to add to the .h, although you should do that anyway because Xcode will complain otherwise, and you won't get method name auto complete.

    I just wrote a test project that embeds a table view in a normal UIView and it works fine. Just make sure your initialization code is being called. I bet you need to move it to awakeFromNib.

提交回复
热议问题