繁体   English   中英

动画时将UIImageView放在最前面

[英]Bring UIImageView to front while animating

制作动画时,如何使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

                    }

见白国王

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

                    }

如果piece是您要位于其兄弟姐妹前面的UIImageView ,请使用:

piece.superview?.bringSubviewToFront(piece)

暂无
暂无

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

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