Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 603
MishieMoo Avatar asked Nov 10 '22 06:11

MishieMoo


1 Answers

try:

[[[cell.button rac_signalForControlEvents:UIControlEventTouchUpInside]
     takeUntil:cell.rac_prepareForReuseSignal]
     subscribeNext:^(id x) {
         // code to be executed here, which doesn't happen
     }];
like image 118
Mateusz Avatar answered Nov 15 '22 07:11

Mateusz