public virtual void SubmitChallengeComplete(UIButton button, ResponseModel response) { RemoveOverlay(); Platform.AnimateRotationComplete(button); if (SubmitButtonImage != null) { button.SetBackgroundImage(SubmitButtonImage, UIControlState.Normal); } if (response != null) { UIView overlay = Platform.AddOverlay(response.ResponseCode > 0); if (overlay != null) { ChallengeCompleteView challengeComplete = ChallengeCompleteView.Create(); overlay.AddSubview(challengeComplete); if (response is ChallengeResponseModel) { challengeComplete.Update(overlay, response as ChallengeResponseModel, Challenge, this); } else if (response is ShareResponseModel) { challengeComplete.Update(overlay, response as ShareResponseModel, Challenge, this); } challengeComplete.TranslatesAutoresizingMaskIntoConstraints = false; overlay.AddConstraint(ChallengesConstraints.ChallengesCollectionCellCenterXConstraint(challengeComplete, overlay)); overlay.AddConstraint(ChallengesConstraints.ChallengesConstantTopConstraint(challengeComplete, overlay, 0f)); overlay.AddConstraint(ChallengesConstraints.ChallengesCollectionCellWidthConstraint(challengeComplete, overlay, 0.94f)); overlay.AddConstraint(ChallengesConstraints.ChallengesCollectionCellHeightConstraint(challengeComplete, overlay, 0.81f)); } } }
public void UpdateItem(nfloat constraintSize) { Background.TranslatesAutoresizingMaskIntoConstraints = false; List <NSLayoutConstraint> constants = new List <NSLayoutConstraint>(); foreach (var constraint in ContentView.Constraints) { if (constraint.FirstAttribute == NSLayoutAttribute.Width || constraint.FirstAttribute == NSLayoutAttribute.Height || constraint.FirstAttribute == NSLayoutAttribute.CenterX || constraint.FirstAttribute == NSLayoutAttribute.CenterY) { constants.Add(constraint); } } ContentView.RemoveConstraints(constants.ToArray()); ContentView.AddConstraint(ChallengesConstraints.ChallengesCollectionCellCenterXConstraint(Background, ContentView)); ContentView.AddConstraint(ChallengesConstraints.ChallengesCollectionCellCenterYConstraint(Background, ContentView)); ContentView.AddConstraint(ChallengesConstraints.ChallengesCollectionCellWidthConstraint(Background, ContentView, constraintSize)); ContentView.AddConstraint(ChallengesConstraints.ChallengesCollectionCellHeightConstraint(Background, ContentView, constraintSize)); }