jjzjj

topConstraint

全部标签

ios - animateWithDuration setFrame 不工作

您好,我有一段代码只有一行不起作用...[UIViewanimateWithDuration:0.3delay:0.0options:UIViewAnimationOptionCurveEaseOutanimations:^{[labelsetFrame:CGRectMake(0,0,frame.size.width,kStandardLabelHeight)];//working[self.currentLabelsetFrame:CGRectOffset(self.currentLabel.frame,frame.size.width,0)];//notworking[self.c

ios - 动画约束更改不起作用

我有一个View,我想根据动画block内的顶部间距约束移动它。这是我使用的代码。约束在变,但框架还是一样的;我该怎么办?我有一个IBOutlet约束名为:topConstraint[UIViewanimateWithDuration:0.3fanimations:^{self.topConstraint.constant-=80;[self.viewlayoutIfNeeded];}];我已经阅读了有关此的所有内容,但它似乎不起作用。 最佳答案 你试过吗:[self.viewsetNeedsUpdateConstraints];