// Add the button to the NSMutableArray.
...
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
[[self hBtns] addObject:btn];
...
// In another method, try to see if it exists.
- (void)didPushBtn:(id)sender
{
UIButton *btn = (UIButton *)sender;
if ([[self hBtns] containsObject:btn]) // Is false every time.
...
}
Why is it not detecting that the UIButton is in the array?
EDIT
It turns out that it won't even detect it right after it's added:
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
[[self hBtns] addObject:btn];
if ([[self hBtns] containsObject:btn]) // Returns false.