5

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?

MishieMoo
  • 6,620
  • 2
  • 25
  • 35

2 Answers2

1

try:

[[[cell.button rac_signalForControlEvents:UIControlEventTouchUpInside]
     takeUntil:cell.rac_prepareForReuseSignal]
     subscribeNext:^(id x) {
         // code to be executed here, which doesn't happen
     }];
Mateusz
  • 1,222
  • 11
  • 22
  • That would just ensure that the same cell doesn't subscribe more than once, which would be the cause of the opposite issue to the one being encountered. – Charles Maria May 08 '15 at 08:50
0

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.

villy393
  • 2,985
  • 20
  • 28