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
  • 30,630
  • 38
  • 174
  • 276

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
  • 54,187
  • 24
  • 128
  • 194