在制作动画时将UIImageView置于正面

时间:2016-04-22 23:47:36

标签: ios swift animation uiimageview

如何在动画制作时让UIImageView超越/高于其他子视图/ UIImageView?请检查图片中的白王

UIView.animateWithDuration(3, animations:{                    
                    self.squares[moveInfo.start.0][moveInfo.start.1].occupyingPieceImageView.frame =
                    self.squares[moveInfo.end.0][moveInfo.end.1].frame

                    }

see the white king

2 个答案:

答案 0 :(得分:2)

UIView.animateWithDuration(3, animations:{
                    self.view.bringSubViewToFront(self.squares[moveInfo.start.0][moveInfo.start.1].occupyingPieceImageView)                  
                    self.squares[moveInfo.start.0][moveInfo.start.1].occupyingPieceImageView.frame =
                    self.squares[moveInfo.end.0][moveInfo.end.1].frame

                    }

答案 1 :(得分:1)

如果piece是您希望在其兄弟姐妹面前的UIImageView,请使用:

piece.superview?.bringSubviewToFront(piece)