Adding a delegate to a custom UITableViewCell (bad access error)

后端 未结 3 1315
离开以前
离开以前 2020-12-10 14:36

I\'m trying to add a custom delegate to a custom UITableViewCell of mine.

On this cell I have a button which need to fire a method in the ViewController where the UI

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-10 15:02

    At first your interface called MyTableViewCell, implementation - iPadCheckTableViewCell. I think both should have the same name.

    And create button like this:

    self.myButton = [UIButton buttonWithType:UIButtonTypeCustom]; // instead of self.myButton = [[UIButton alloc] init]; - it's a memory leak
    

提交回复
热议问题