MishieMoo
MishieMoo

Reputation: 6680

rac_signalForControlEvents not signaling in a UICollectionViewCell

I have a bunch of UICollectionViewCells containing buttons. For some reason, my signal refuses to fire when a button is inside of a UICollectionViewCell. Switching to the normal addTarget:action:forControlEvents: will work, but not the RAC signal. I've had this happen in 2 different collection views, and 2 different custom collection cells.

All I'm doing is:

[[cell.button rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(id x) {
        // code to be executed here, which doesn't happen
}];

What am I missing?

Upvotes: 5

Views: 814

Answers (2)

villy393
villy393

Reputation: 3063

I don't have enough reputation to comment so I will just comment here. It seems that there is something wrong with the button instance that is causing the signal not to fire. How are your buttons instantiated and where in the tableView:cellForRow:atIndexPath are you subscribing to the signal.

Upvotes: 0

Mateusz
Mateusz

Reputation: 1224

try:

[[[cell.button rac_signalForControlEvents:UIControlEventTouchUpInside]
     takeUntil:cell.rac_prepareForReuseSignal]
     subscribeNext:^(id x) {
         // code to be executed here, which doesn't happen
     }];

Upvotes: 1

Related Questions