LoginSignup
4
4

More than 5 years have passed since last update.

Swift3でUIViewを拡大縮小させる方法

Posted at

animateWithDurationを使うとビュイーン!とアニメーションできます

//ボタンアクション
@IBAction func btnUp(sender: AnyObject) {

//変数で使いたければCGRectの引数へどうぞ
 let xPosition = DynView.frame.origin.x
 let yPosition = DynView.frame.origin.y - 20
 let height = DynView.frame.size.height
 let width = DynView.frame.size.width

//アニメーション処理
 UIView.animateWithDuration(1.0, animations: {

  //拡大縮小の処理
  dynView.frame = CGRect(x:10, y:10, width:10, height:10)

 })
}

参考

UIView changing its position in swift

Swift3でUIViewを拡大縮小させる方法

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4