diff --git a/MasterPassword/ObjC/iOS/MPAvatarCell.m b/MasterPassword/ObjC/iOS/MPAvatarCell.m index 9b16d7d7..cc874ef6 100644 --- a/MasterPassword/ObjC/iOS/MPAvatarCell.m +++ b/MasterPassword/ObjC/iOS/MPAvatarCell.m @@ -139,9 +139,7 @@ const long MPAvatarAdd = 10000; super.highlighted = highlighted; - [UIView animateWithDuration:0.1f animations:^{ - self.avatarImageView.transform = highlighted? CGAffineTransformMakeScale( 1.1f, 1.1f ): CGAffineTransformIdentity; - }]; + self.avatarImageView.transform = highlighted? CGAffineTransformMakeScale( 1.1f, 1.1f ): CGAffineTransformIdentity; } - (void)setMode:(MPAvatarMode)mode { @@ -168,7 +166,7 @@ const long MPAvatarAdd = 10000; _spinnerActive = spinnerActive; CABasicAnimation *rotate = [CABasicAnimation animationWithKeyPath:@"transform.rotation"]; - rotate.toValue = [NSNumber numberWithDouble:2 * M_PI]; + rotate.toValue = @(2 * M_PI); rotate.duration = 5.0; if (spinnerActive) { @@ -206,10 +204,10 @@ const long MPAvatarAdd = 10000; switch (self.mode) { case MPAvatarModeLowered: { - [[self.avatarSizeConstraint updateConstant:self.avatarImageView.image.size.height] layoutIfNeeded]; - [[self.avatarRaisedConstraint updatePriority:UILayoutPriorityDefaultLow] layoutIfNeeded]; - [[self.avatarToTopConstraint updatePriority:UILayoutPriorityDefaultLow] layoutIfNeeded]; - [[self.nameToCenterConstraint updatePriority:UILayoutPriorityDefaultLow] layoutIfNeeded]; + [self.avatarSizeConstraint updateConstant:self.avatarImageView.image.size.height]; + [self.avatarRaisedConstraint updatePriority:UILayoutPriorityDefaultLow]; + [self.avatarToTopConstraint updatePriority:UILayoutPriorityDefaultLow]; + [self.nameToCenterConstraint updatePriority:UILayoutPriorityDefaultLow]; self.nameContainer.alpha = self.visibility; self.nameContainer.backgroundColor = [UIColor clearColor]; self.avatarImageView.alpha = self.visibility / 0.7f + 0.3f; @@ -217,10 +215,10 @@ const long MPAvatarAdd = 10000; break; } case MPAvatarModeRaisedButInactive: { - [[self.avatarSizeConstraint updateConstant:self.avatarImageView.image.size.height] layoutIfNeeded]; - [[self.avatarRaisedConstraint updatePriority:UILayoutPriorityDefaultHigh] layoutIfNeeded]; - [[self.avatarToTopConstraint updatePriority:UILayoutPriorityDefaultLow] layoutIfNeeded]; - [[self.nameToCenterConstraint updatePriority:UILayoutPriorityDefaultLow] layoutIfNeeded]; + [self.avatarSizeConstraint updateConstant:self.avatarImageView.image.size.height]; + [self.avatarRaisedConstraint updatePriority:UILayoutPriorityDefaultHigh]; + [self.avatarToTopConstraint updatePriority:UILayoutPriorityDefaultLow]; + [self.nameToCenterConstraint updatePriority:UILayoutPriorityDefaultLow]; self.nameContainer.alpha = self.visibility; self.nameContainer.backgroundColor = [UIColor clearColor]; self.avatarImageView.alpha = 0; @@ -228,10 +226,10 @@ const long MPAvatarAdd = 10000; break; } case MPAvatarModeRaisedAndActive: { - [[self.avatarSizeConstraint updateConstant:self.avatarImageView.image.size.height] layoutIfNeeded]; - [[self.avatarRaisedConstraint updatePriority:UILayoutPriorityDefaultHigh] layoutIfNeeded]; - [[self.avatarToTopConstraint updatePriority:UILayoutPriorityDefaultLow] layoutIfNeeded]; - [[self.nameToCenterConstraint updatePriority:UILayoutPriorityDefaultHigh] layoutIfNeeded]; + [self.avatarSizeConstraint updateConstant:self.avatarImageView.image.size.height]; + [self.avatarRaisedConstraint updatePriority:UILayoutPriorityDefaultHigh]; + [self.avatarToTopConstraint updatePriority:UILayoutPriorityDefaultLow]; + [self.nameToCenterConstraint updatePriority:UILayoutPriorityDefaultHigh]; self.nameContainer.alpha = self.visibility; self.nameContainer.backgroundColor = [UIColor blackColor]; self.avatarImageView.alpha = 1; @@ -239,10 +237,10 @@ const long MPAvatarAdd = 10000; break; } case MPAvatarModeRaisedAndHidden: { - [[self.avatarSizeConstraint updateConstant:self.avatarImageView.image.size.height] layoutIfNeeded]; - [[self.avatarRaisedConstraint updatePriority:UILayoutPriorityDefaultHigh] layoutIfNeeded]; - [[self.avatarToTopConstraint updatePriority:UILayoutPriorityDefaultLow] layoutIfNeeded]; - [[self.nameToCenterConstraint updatePriority:UILayoutPriorityDefaultHigh] layoutIfNeeded]; + [self.avatarSizeConstraint updateConstant:self.avatarImageView.image.size.height]; + [self.avatarRaisedConstraint updatePriority:UILayoutPriorityDefaultHigh]; + [self.avatarToTopConstraint updatePriority:UILayoutPriorityDefaultLow]; + [self.nameToCenterConstraint updatePriority:UILayoutPriorityDefaultHigh]; self.nameContainer.alpha = 0; self.nameContainer.backgroundColor = [UIColor blackColor]; self.avatarImageView.alpha = 0; @@ -250,10 +248,10 @@ const long MPAvatarAdd = 10000; break; } case MPAvatarModeRaisedAndMinimized: { - [[self.avatarSizeConstraint updateConstant:36] layoutIfNeeded]; - [[self.avatarRaisedConstraint updatePriority:UILayoutPriorityDefaultLow] layoutIfNeeded]; - [[self.avatarToTopConstraint updatePriority:UILayoutPriorityDefaultHigh] layoutIfNeeded]; - [[self.nameToCenterConstraint updatePriority:UILayoutPriorityDefaultHigh] layoutIfNeeded]; + [self.avatarSizeConstraint updateConstant:36]; + [self.avatarRaisedConstraint updatePriority:UILayoutPriorityDefaultLow]; + [self.avatarToTopConstraint updatePriority:UILayoutPriorityDefaultHigh]; + [self.nameToCenterConstraint updatePriority:UILayoutPriorityDefaultHigh]; self.nameContainer.alpha = 0; self.nameContainer.backgroundColor = [UIColor blackColor]; self.avatarImageView.alpha = 1; @@ -274,6 +272,8 @@ const long MPAvatarAdd = 10000; self.avatarImageView.backgroundColor = [UIColor clearColor]; self.avatarImageView.layer.cornerRadius = self.avatarImageView.bounds.size.height / 2; self.spinner.alpha = self.spinnerActive? 1: 0; + + [self layoutIfNeeded]; } completion:nil]; } diff --git a/MasterPassword/ObjC/iOS/MPPasswordsViewController.m b/MasterPassword/ObjC/iOS/MPPasswordsViewController.m index 9cf23a2a..3eaa3cab 100644 --- a/MasterPassword/ObjC/iOS/MPPasswordsViewController.m +++ b/MasterPassword/ObjC/iOS/MPPasswordsViewController.m @@ -440,8 +440,9 @@ referenceSizeForHeaderInSection:(NSInteger)section { _active = active; [UIView animateWithDuration:animated? 0.4f: 0 animations:^{ - [[self.navigationBarToTopConstraint updatePriority:active? 1: UILayoutPriorityDefaultHigh] layoutIfNeeded]; - [[self.passwordsToBottomConstraint updatePriority:active? 1: UILayoutPriorityDefaultHigh] layoutIfNeeded]; + [self.navigationBarToTopConstraint updatePriority:active? 1: UILayoutPriorityDefaultHigh]; + [self.passwordsToBottomConstraint updatePriority:active? 1: UILayoutPriorityDefaultHigh]; + [self.view layoutIfNeeded]; } completion:completion]; } diff --git a/MasterPassword/ObjC/iOS/MPUsersViewController.m b/MasterPassword/ObjC/iOS/MPUsersViewController.m index 14eff51f..ffbb129b 100644 --- a/MasterPassword/ObjC/iOS/MPUsersViewController.m +++ b/MasterPassword/ObjC/iOS/MPUsersViewController.m @@ -786,7 +786,7 @@ typedef NS_ENUM(NSUInteger, MPActiveUserState) { // Manage the entry container depending on whether a user is activate or not. switch (activeUserState) { case MPActiveUserStateNone: { - [[self.navigationBarToTopConstraint updatePriority:UILayoutPriorityDefaultHigh] layoutIfNeeded]; + [self.navigationBarToTopConstraint updatePriority:UILayoutPriorityDefaultHigh]; self.avatarCollectionView.scrollEnabled = YES; self.entryContainer.alpha = 0; self.footerContainer.alpha = 1; @@ -796,7 +796,7 @@ typedef NS_ENUM(NSUInteger, MPActiveUserState) { case MPActiveUserStateUserName: case MPActiveUserStateMasterPasswordChoice: case MPActiveUserStateMasterPasswordConfirmation: { - [[self.navigationBarToTopConstraint updatePriority:UILayoutPriorityDefaultHigh] layoutIfNeeded]; + [self.navigationBarToTopConstraint updatePriority:UILayoutPriorityDefaultHigh]; self.avatarCollectionView.scrollEnabled = NO; self.entryContainer.alpha = 1; self.footerContainer.alpha = 1; @@ -804,13 +804,15 @@ typedef NS_ENUM(NSUInteger, MPActiveUserState) { break; } case MPActiveUserStateMinimized: { - [[self.navigationBarToTopConstraint updatePriority:1] layoutIfNeeded]; + [self.navigationBarToTopConstraint updatePriority:1]; self.avatarCollectionView.scrollEnabled = NO; self.entryContainer.alpha = 0; self.footerContainer.alpha = 0; break; } } + + [self.view layoutIfNeeded]; } completion:^(BOOL finished) { [_afterUpdates setSuspended:NO]; }];