简体   繁体   English

UIView约束不适用于iPhone 3.5

[英]UIView Constraint not working on iPhone 3.5

I am animating a constraint on an iOS7 app. 我正在为iOS7应用设置动画。 On the iPhone 4" screen it works, but the same code on an iPhone 3.5" does not work. 在iPhone 4“屏幕上可以使用,但是在iPhone 3.5”上不能使用相同的代码。 Both are running iOS7. 两者都在运行iOS7。 I have no clue why it works on one size phone but not the other? 我不知道为什么它可以在一种尺寸的手机上使用,而不能在另一种尺寸上使用?

-(void)showBottomRequestView {

[self.view layoutIfNeeded]; // Ensures that all pending layout operations have been completed

[UIView animateWithDuration:0.5 delay:0.3 options:(UIViewAnimationCurveEaseOut) animations:^{

    self.qBottomConstraint.constant = 65; <-- this UIView only works on  4.0"
    self.meBottomConstraint.constant = 65; <-- this UIButton works on 3.5" and 4.0"

    [self.view layoutIfNeeded];

} completion:^(BOOL finished) {
    //
}];

}

一个可能的原因可能是UIView约束值已经是您要为其设置动画的值了……您可以将其放置在4英寸和3.5英寸尺寸的屏幕的3.5英寸区域内,并查看它是否适用于两种尺寸。

Probably not the best way, but I added another constraint and did an if/else. 可能不是最好的方法,但是我添加了另一个约束并做了一个if / else。

if(3.5) 
  do 3.5 constraint

else 
  do 4.0 constraint

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM