LoginSignup
11
11

More than 5 years have passed since last update.

顔画像表示で良くある四角画像の円形切り抜き表示

Last updated at Posted at 2015-01-13

はじめに

UIImageViewを円形切り抜き表示します。
やってみると「まあ...そういうことだよね」のシンプルさでした。

実装

円形切り抜き表示
+ (void)clipToCircle:(UIImageView *)imageView
{
    imageView.layer.cornerRadius = imageView.frame.size.width * 0.5f;
    imageView.clipsToBounds = YES;
}

追記実装

UIImageViewに限らず、UIViewでもOKです。

円形切り抜き表示
+ (void)clipToCircle:(UIView *)view
{
    view.layer.cornerRadius = view.frame.size.width * 0.5f;
    view.clipsToBounds = YES;
}

おわりに

プロフィール画像の表示時に使いました。
何かに参考になりましたら幸いです。

11
11
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
11
11