简体   繁体   中英

UIView Constraint not working on iPhone 3.5

I am animating a constraint on an iOS7 app. On the iPhone 4" screen it works, but the same code on an iPhone 3.5" does not work. Both are running 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(3.5) 
  do 3.5 constraint

else 
  do 4.0 constraint

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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