0
votes

The app is using a UITabBarController as its root controller. In one of the views, I am using Tap Gesture Recognizer for camera's focus and expose. The Tap Gesture Recognizer is set in Storyboard and linked to a IBAction in the implementation file. When user tap the screen, the IBAction method is not called and no action is made.

It is working well in the previous version without UITabBarController.

I tried to print out self.view.window in "viewDidLoad" in that view controller and got "(null)" .

Using Xcode 6.1 and running in iOS 8.

Do you have some ideas why this happen and the solution to this issue? Thank you in advance!

1
When you tap on the view in question in the storyboard, what do you see in the connections inspector? You should see a valid connection of the gestureRecognizers outlet collection to your view controller's view.Fergal Rooney
@FergalRooney Thank you for your reply which gave me the inspiration to solve the problem! Please see the updates of the question.Zhihao Yang

1 Answers

0
votes

Problem solved, turns out it's nothing to do with the Tab bar.

What I did wrongly is in the storyboard I linked the gesture recognizer to a wrong item above the camera preview view. Solution is to delete that connection and relink: select the tap gesture recognizer and open Connection inspector and drag "Referencing Outlet Collections" to the view your want.

,

Thanks @Fergal Rooney for reminding me to check the connection inspector which I forgot to check out, because I always thought it was a problem with the tab bar or the iOS version or the Xcode version.