0

I am trying to do

__weak UIButton *ptr = self.backBtn;
self.footer.defaultSelectedItem.selectionBlock = ^{
    [ptr sendActionsForControlEvents:UIControlEventTouchUpInside];
};

and I'm getting an infinite loop on my code anyway.

I've already referred to:

With no promising result. My program still hangs and then after a minute xcode dumps out a huge loop cycle once I run out of memory. What should I do?

EDIT

I should have also pointed out that I'm using Automatic Reference Counting (ARC).

Community
  • 1
  • 1
Jacksonkr
  • 31,583
  • 39
  • 180
  • 284

1 Answers1

1

Let your block have a flag to tell it not to execute:

 __block BOOL flag = NO;
 .... = ^{
      if (flag) return;

      flag = YES;
      // rest of block code here.
      flag = NO;
};
Richard J. Ross III
  • 55,009
  • 24
  • 135
  • 201