samedi 25 avril 2015

Is overriding of constraints() and removeConstraints() necessary when creating a custom control?


I'm creating a custom control that uses auto-layout to arrange its subviews.

Naturally, I don't want users of my custom control to inadvertently mess with these internal constraints when programmatically manipulating the control's constraints so I thought I should override constraints() to hide those internal ones the user should never need to know about and also removeConstraints() to prevent the user from removing them.

But then it occurred to me that UIKit itself probably invokes constraints() and/or removeConstraints() and expects to be able to see all of them.

So, should I or should I not, override constraints() and removeConstraints() ?


Aucun commentaire:

Enregistrer un commentaire