XCode 12 - iOS 14 - UIButton IBAction not working - uibutton

I'm facing a problem with XCode12 in my iPhone XS with iOS 14.
Don't know why, when I execute my app, the IBActions and segues doesn't work. Any of them, but if I launch the app in XCode11.7 (without changing a line of code) all the IBActions and segues work perfectly.
I'm not doing anything special, just UIButton with IBAction or UIButton that triggers a segue directly.
Any idea?
Regards
Edit (25/09/2020):
So, I found out that, if the view has some uibutton that triggers a segue directly (figure 1), this doesn't work. In fact, if you try to trigger this segue, the rest of the uibuttons that have an IBAction implemented into the ViewController stop working. The rest of the UIButtons with IBActions works since I tap on a UIButton with a direct segue.
FIGURE 1:

Related

3 programmatically created UIButtons - how to go between 3 UIViewControllers using those buttons with Storyboard?

Playing around with some Objective-C (well, iOS) and have done the following... loaded some UIButtons programmatically into a UIScrollView. That works well. Though I've always just connected UIViewControllers together using control-click and drag. Now I've created buttons programmatically, I have no idea how to go from one view controller to another in a Storyboard because there is nothing to drag from!
I'm not really sure what code to post as such, because I haven't done anything that /nearly/ works or doesn't work as such. I get how to do it with XIBs. But I suppose the question is : 3 UIButtons have been created programmatically and I have 3 UIViewControllers. How do I access those ViewControllers using my UIButtons?
Thanks
In the Interface builder view control click and drag from the viewcontroller icon under the first view controller, to the middle of the second view controller. A segue will be created, selected the appropriate type.
Now select the segue and in the inspector give it a unique identifier (say 'myNewSegue').
Now in your first viewcontroller you can create a method that has the following code:
-(void)myButtonAction:(id)sender {
[self performSegueWithIdentifier:#"myNewSegue" sender:self];
}
And add this method as a target action to your button:
[myButton addTarget:self
action:#selector(myButtonAction:)
forControlEvents:UIControlEventTouchUpInside];]
A segue doesn't have to have a button at the leading end of it; you can instead draw it from an entire view controller to another. You can also give a segue an identifier, a string that's used as a name for that segue. Once you've done that, you can programmatically trigger that segue by calling -performSegueWithIdentifier:sender:.
To actually call -performSegueWithIdentifier:sender:, though, you'll need to connect the button to a target and action. If you've never done that, read the Event Handling Guide for iOS in your documentation.

UISearchBar doesn't work in an IOS 6 Popover

The app has a UIView with a table view and a UISearchbar on it. The searchbar delegate methods are in the view controller for the UIView. Everything appears to be hooked up correctly.
This searchbar works correctly in iOS 5, but not in iOS6. When touched, the searchbar brings up the keyboard, but typing on the keyboard has no affect; the textDidChange delegate method is never called.
This occurs only when running on an iPad. The difference between the view on an iPad versus the iPhone is that the UIView with the UITableView and UISearchbar runs in a popover on the iPad. On an iPhone, it runs as a separate view. In both cases, once the view is opened, a UINavigationController manages the view. All the navigation up and down the nav controller works fine in both devices; the only difference is that the UISearchBar does not work running in the popover.
Obviously, something has changed between iOS 5 and iOS 6, but I haven't been able to figure out what, or how to make the searchbar work in an iOS 6 popover.
Any help will be greatly appreciated!
rokjarc is right. I have same problem. In my app'SearchBar Display Controller, SearchBar is not respond to keypad typing in ios6. But it is fine in ios5 simulater, ios6 simulater, iPhone 3GS, iPhone 4.
In MainWindow.xib,
1. Click "Window" icon in "objects" Box.
2. Show Attribute inspector
3. Expend window attribute.
4. Check "Visible at Launch" and "Full Screen at Launch"
5. Clean build and run.
6. Good. OK?
I just got the answer on my original problem. I discovered that the same thing was occurring in UITextFields and UITextViews. I sent the whole thing off to Apple Tech Support.
Turns out that you have to include this line of code:
[self.window makeKeyAndVisible];
in the application's delegate's didFinishLaunchingWithOptions: method. When I added this line, the problems went away.
Hope this helps.

IBAction not getting called for my textfields inside the scroll view

I am having a ScrollView which is a child of a View and then several textfields as children of
this ScrollView. I am trying to give IBAction to these textfields via nib and setting the
delegates of the textfields also via nib.The delegate method of UITextField gets called
without any problem,but the IBAction for the TextField is never called. My view hierarchy is
as follows
UIView -->(TopMost Level )
|
ScrollView-->(Child of UIView)
|
Several TextFields-->(children of Scrollview)
All the TextFields are having the same IBAction. I am working on Xcode 4.5 and working on
ARC based project. Any help is greatly appreciated.
Finally I worked around and found a solution my self.
I was declaring IBAction with Touch Down Event which works perfectly fine if TextField is
inside the UIView not the ScrollView.
But when the TextField is inside the ScrollView , the IBAction for the TextField should be
declared with EditingDidBeginEvent.
I don't know the reason behind it though.

UIBarButtonItem sent action works on iOS 6 but not iOS 5

I am going to tear my hair out because I cannot think of a logical reason why this occurs on 5 but not 6. So basically, I have a view presented in modal fashion with a navigation bar and a Cancel button (UIBarButtonItem - no custom anything on it, just a standard button) in the navigation bar. When this Cancel button is tapped, I want the modal view to disappear. This works just fine in iOS 6. But for iOS 5 it refuses to work for 2 out of 3 places I have it in my code. What's odd to me is that it works on one but not the other two.
Using storyboards, I right click the button, click on "selector" under Sent Actions, and drag over to the appropriate IBAction method in my view controller's .h file. The link is successfully confirmed with the little blinking animation in Xcode. When I run the app on iOS 6 (simulator or device doesn't matter), the method is successfully executed upon button tap and my modal view dismissed. However, on iOS 5, the method is never even called (I set breakpoints inside the method to see if they would be hit). I've even tried switching the argument in my IBAction method from id to UIBarButtonItem *. No cigar, though.
I've also tried programmatically (in viewDidLoad) setting the cancel button's action to a selector. I've even set the target to the VC. No cigar again. Here is a screenshots of my current setup:
Please note the IBAction methods.
Is there some magical clause in the documentation that I missed? Something awfully special I need to do in order to get it to work in iOS 5? It sure seems like a bug to me, but I'm still fairly new to this stuff so what do I know.
I am using Xcode 4.5.2 and storyboards, and targeting iOS 5 and iOS 6 for the release.
Your help is appreciated, thank you.
I think there may be problem of using GestureRecognizer please comment that code and try it...
I added a separate UIView that resides under my textfields and button and below the navigation bar/title. I added the tap gesture to that programmatically, and that seems to recognize both my tap and the cancel button's action. I still would like to know why the tap gesture swallows up the UIBarButtonItem's action if the gesture is on the root view. This question helped me figure this out. Thanks.
you can exclude view/control from gesture recognizer using following delegate method.
// UIGestureRecognizerDelegate
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
// exclude your view from gesture recognizer
if(yourView == touch.view)
{
return NO;
}
//
return YES;
}

iOS - Double Tap Gesture does not work on top of a UIWebView

I have a viewController that has several items added programatically. A UILabel and a UIWebView including a scroll view.
Now I have added a swipe gesture onto the viewController using storyboard and when run all seems ok.
The issue comes when I try to swipe over the the UIWebview, it does not trigger the the Swipe gesture and looks as if its cancelling it out.
How can i enable it so the gesture works over the whole view but yet keeping the UIWebview functionality?
You can set
[UIWebView.scrollView setDelegate:myViewController]
and implement in your view controller
-(void)scrollViewDidScroll:(UIScrollView *)sender
But to really pass events, you will need more:
http://mithin.in/2009/08/26/detecting-taps-and-events-on-uiwebview-the-right-way/