UIButton above thumbnail


#1

[code]- (IBAction)showImage:(id)sender
{
NSString *selector = NSStringFromSelector(_cmd);
selector = [selector stringByAppendingString:@“atIndexPath:”];
SEL newSelector = NSSelectorFromString(selector);

NSIndexPath *indexPath = [[self tableView] indexPathForCell:self];
if (indexPath) {
    if ([[self controller] respondsToSelector:newSelector]) {
        [[self controller] performSelector:newSelector
                                withObject:sender
                                withObject:indexPath];
    }
}

}[/code]

The code above gets called when I tap the UIButton above the thumbnail. The problem is the first if-statement. When I debug indexPath gets a value at line: NSIndexPath *indexPath = [[self tableView] indexPathForCell:self]; However when it reaches the if-statement indexPath equals nil!

What have I done wrong?

When I open the project from this webpage it works. But if I copy the method to my project it still doesn’t work