Note that there are some explanatory texts on larger screens.

plurals
  1. POThe UIButton does not always fire
    text
    copied!<p>I have seen several similar questions but not anyone that has the answer to this question.</p> <p>I have a view with some programmatically created buttons. The problem is that the buttons only fires sometimes. If I touch a button at <em>exactly the same spot</em> several consecutive times it will either <em>always fire</em> or <em>never fire!</em> (I use the simulator and the MacBook's track-pad to hit exactly the same spot). I have the feeling that only 50% of the pixels within the button are active!!</p> <p>Here is how the button is created:</p> <pre><code>// Button Memory Recall UIButton *buttMR = [UIButton buttonWithType:UIButtonTypeRoundedRect]; buttMR.frame = CGRectMake(55, y, 50, 40); [buttMR setTitle:@"TEST" forState:UIControlStateNormal]; [buttMR addTarget:self action:@selector(memoryRecord:) forControlEvents:UIControlEventTouchUpInside]; [buttMR addTarget:self action:@selector(touchDownButt:) forControlEvents:UIControlEventTouchDown]; buttMR.showsTouchWhenHighlighted = YES; buttMR.titleLabel.font = [UIFont systemFontOfSize:12]; buttMR.tintColor = [UIColor orangeColor]; [buttMR sizeToFit]; // remove this later... [self addSubview:buttMR]; self.buttMRec = buttMR; </code></pre> <p>The app is rather complex. The view that contains the buttons (view B) is a subview of view A. The button view is not always shown. It is created, and slides in to cover view A when it is needed. </p> <p><img src="https://i.stack.imgur.com/10sP4.png" alt="enter image description here"></p> <p>Update: For some very strange reason, the info button on view A seems to cause the problem. If I replace that button by a rounded rect button, it seems to works fine. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload