簡體   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