1

From this stack example i figured out how to animate the constant parameter of a named constraint. It works fine, but I've encountered a problem I haven't found a solution to. I have the UIViewAnimationOptionBeginFromCurrentState option set for the animation and via an IBAction method want to be able to switch animations final state, even during the animation. Here is the code:

- (IBAction)animate:(id)sender {
    self.brownViewHeightConstraint.constant = self.expanded ? 100.f : 390.f;
    [self.brownView setNeedsUpdateConstraints];
    self.expanded = !self.expanded;

    [UIView animateWithDuration: 1.0
                          delay: 0
                        options: UIViewAnimationOptionBeginFromCurrentState
                     animations: ^{
                         [self.brownView layoutIfNeeded];
                     }
                     completion:^(BOOL finished) {
                     }
     ];
}

The animation doesn't honor the UIViewAnimationOptionBeginFromCurrentState option. How would I accomplish this behavior using AutoLayout?

Community
  • 1
  • 1
Olof
  • 11
  • 2
  • Is this either insanely simple, or does no one really have an answer to this? Either way, I'd love a kick in the right direction... – Olof Feb 12 '14 at 07:08

0 Answers0