Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constraints are wrong if text property is set prior to layout #2

Open
andreasmpet opened this issue Sep 19, 2016 · 0 comments
Open

Comments

@andreasmpet
Copy link

andreasmpet commented Sep 19, 2016

Hi! I noticed that if I set the .text property of the text field to a value prior to the view being laid out, the first time the placeholder animates, it will animate based on a very wrong location. My fix is to also update the constraints when the bounds of the view changes. Here's some code you can add to the class:

- (void)setBounds:(CGRect)bounds
{
    BOOL boundsChanged = !CGRectEqualToRect(self.bounds, bounds);
    [super setBounds:bounds];
    if (boundsChanged) {
        [self updateConstraintsToCurrentState];
    }
}

Thanks for the nice pod :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant