UITapGestureRecognizer de la biblioteca Objetos en el guión gráfico en una vista que está dentro de un controlador de barra de pestañas

I added a UITapGestureRecognizer to a view which is inside a tab bar controller and when I switch to the tab which contains the view with the UITapGestureRecognizer, I get a crash with the message -

-[__NSCFString setView:]: unrecognized selector sent to instance 0x2ae8d0

Estoy usando Xcode 4.3

preguntado el 24 de agosto de 12 a las 02:08

It looks like you connected something up to the wrong object. Did you add the gesture recognizer in IB or in code? -

In IB by dragging on to the storyboard. Should've done it in code. -

Nevermind. I just added it in code and it works fine. Thanks for help. -

1 Respuestas

i had this same trouble on iOS5 only with an app targeted to iOS 5 and iOS 6 and a gesture recognizer on the last tab. our code also has very similar gesture-recognizers that are loaded for modal dialogs or pushed view controllers for other tabs. so it was only gesture-recognizers in a tab that was not the first tab, and only in the rootViewController for that tab.

as Arunabh Das ended up doing, it would seem the only answer is really to add the UIGestureRecognizers in code. there is a thread at Ray Wenderlich's website (which is a decent site containing some good iOS tips) , which, summarized, notes that there appears to be a bug in iOS5, starting with the beta versions, never fixed in the final, and containing a code-snippet that shows how to put the gesture-recognizers in code if you want them.

Respondido el 30 de enero de 13 a las 09:01

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.