I have an info button that appears as an overlay UIView on top of a camera view that is not linking to the desired view controller. Nothing happens when it is touched.
Here is the code to create the button and link it
// Create a Button to get Help
infoButton = [UIButton buttonWithType:UIButtonTypeInfoLight ] ;
CGRect buttonRect = infoButton.frame;
// Calculate the bottom right corner
buttonRect.origin.x = 455;
buttonRect.origin.y = 297;
[infoButton setFrame:buttonRect];
[infoButton addTarget:self action:@selector(presentInfo) forControlEvents:UIControlEventTouchUpInside];
[view addSubview:infoButton];
Here is the code to create segue
- (void) presentInfo
{
InfoViewController *ivc = [self.storyboard instantiateViewControllerWithIdentifier:@"InfoViewController"];
[self presentModalViewController:ivc animated:YES];
}
Try this first:
– Set a breakpoint in:
if the program reach this point it must be a problem with the segue.
I had some problems with button this week too. In my case there once was an other UIView over my button, so it doesn’t hit the selector.
Or you can try and change:
In:
Also look if the button react to your touch with the alternative image.
I hope this helps
Oh or try and give it a UITapGestureRecognizer you make, but this is only for the real desperate solution, if nothing else works…