delegate not being called

只愿长相守 提交于 2019-12-02 03:14:25

Are you actually setting the delegate after creating MyCell?

Easy way to check is add a breakpoint and see if the delegate reference is nil (0x0).

EDIT: Base on your comments below, pretty sure you are never setting the delegate.

When you create your cell, you have to pass in the delegate object to that cell so it has something to call. Otherwise, you are just sending a message to a nil object.

So, assuming you are creating your cells normally in the table view controller:

MyCell *cell = (MyCell *)[tableView dequeueReusableCellWithIdentifier:@"CellID"];
    if (cell == nil) {
        NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"MyCell" owner:self options:nil];
        cell = [topLevelObjects objectAtIndex:0];
        cell.delegate = self; // <-------- set the delegate after creation
    } else {
        NSLog(@"cached cell");
    }

   //Do you other cell stuff, setting mid and uid for example.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!