0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【メモ】UIViewの拡大、回転、移動する方法

Posted at

swiftの勉強メモとして記録します。
※目新しい情報などはないと思います。

CGAffineTransform で画像を回転、移動、反転させることができる
2Dグラフィックの描画に使われる、アフィン変換を表します。

UIViewに存在するtransformプロバティを用いて、viewに対して変更を行う。

使い方

回転
CGAffineTransform(rotationAngle: CGFloat(angle))

拡大・縮小
CGAffineTransform(scaleX: A, y:B)
(AまたはBを負の値にすると反転される)

移動
CGAffineTransform(tranlationX:C, y:D)

transScale = CGAffineTransform(scaleX:2, y:2)
imageView.transform = transScale
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?