簡體   English   中英

UIView約束不適用於iPhone 3.5

[英]UIView Constraint not working on iPhone 3.5

我正在為iOS7應用設置動畫。 在iPhone 4“屏幕上可以使用,但是在iPhone 3.5”上不能使用相同的代碼。 兩者都在運行iOS7。 我不知道為什么它可以在一種尺寸的手機上使用,而不能在另一種尺寸上使用?

-(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英寸區域內,並查看它是否適用於兩種尺寸。

可能不是最好的方法,但是我添加了另一個約束並做了一個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