xmartlabs/XLForm

formViewController assumes XLFormViewController is in the responder chain

Open

#720 ouverte le 5 févr. 2016

Voir sur GitHub
 (2 commentaires) (0 réactions) (0 assignés)Objective-C (969 forks)batch import
help wanted

Métriques du dépôt

Stars
 (5 786 stars)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

Description

The method formViewController in XLFormBaseCell.m tries to get the form VC associated with the cell by climbing up the responder chain until it hits any VC. This seems like a bad assumption and here's why:

It's a generally accepted practice to have a VC (A) own another VC (B) using the child view controller array and add B's view to A. In that case, B will no longer be in the responder chain (I actually didn't know this, go figure) and the assumption made above is then violated. I have a case like this because I'm using the view of an XLFormVIewController as a subview of a monolithic VC. This is breaking the formViewController method and wreaking all sorts of havoc.

My interim fix will be to overwrite that method with a category extension to do some special logic that handles my case. In general, though, maybe cells should just keep a weak reference to their XLFormViewController if they really need it? This feels like a more sound approach.

Guide contributeur