0

I have created an application where I try to utilize the new features in Interface Builder (Storyboard, GestureRecognizers etc.) I start off by choosing that Tabbed Application template . I then add a SwipeGestureRecognizer to each view in their corresponding view controller. The SwipeGesture is connected to a method that calls resignFirstResponder on each text input.

The SwipeGesture works as expected in the first view but when I try to press a tab to switch view the app crashes. The error that I get is SIGBART or EXC_BAD_ACCESS. If I remove the GestureRecognizers from the second view the second view loads without any problems.

This problem does not occur if I for example choose to use UtilityApplication template and add the gesture recognizers in the same way as I did in the Tabbed Application template.

Can anyone give me any pointers on how I can solve this problem. I'm afraid that I can't provide much code since the only code that I have added is an IBOutlet to the UITextField and the method called when the gesture has occurred

- (IBAction) hideKeyBoard:(id)sender{
    [textField resignFirstResponder];
}

This is an image of my setup in Interface Builder. The view called ViewController is working but when I try to load the SettingsViewController the app crashes.

This is an image of my setup in Interface Builder. The view called ViewController is working but when I try to load the SettingsViewController the app crashes.

Update: If i added the gesture recognizers programmatically instead the above problem didn't occur.

ehenrik
  • 103
  • 2
  • 11

1 Answers1

1

It's a UIKit bug.

To keep using Storyboard / Interface Builder add a strong IBOutlet in your UIViewController and connect it to the UIGestureRecognizer. Works like a charme :)

onigiri
  • 93
  • 1
  • 1
  • 5