I have a button that I configure like this in my .h file:
- (IBAction)addBusiness:(id)sender;
@property (weak, nonatomic) IBOutlet UIButton *planBusinessButton;
then I do this in my .m file:
- (IBAction)addBusiness:(id)sender
{
NSLog(@"Plan business clicked 1");
}
- (IBAction)planBusinessButton:(id)sender
{
NSLog(@"Plan business clicked 1");
}
but in my onLoad I do something like this:
CGPoint pt = planBusinessButton.center;
pt.y -= 275;
planBusinessButton.center = pt;
The problem is that the button click is not firing in the IBAction when I click the button.
Would the changing of the location of the button have an effect on why the button is not getting clicked?
Why would the button click not fire in the IBAction?
Thanks!
EDIT: Moving the button should not affect it’s action firing, unless it’s moved off the view or being below some other view that would intercept the tap.
If tap is not firing the button, check that:
Try to avoid doing any view modifications in viewDidLoad method, as the view is not ready yet…
instead, try setting the button center in viewDidAppear method.