67
66

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 5 years have passed since last update.

iOS Second StageAdvent Calendar 2013

Day 9

iOS7 blur image[磨りガラスっぽい表現を実現する]

Last updated at Posted at 2013-12-17

#概要
iOS7 いろんなところで磨りガラス風なviewを使っている。実は実装は結構簡単で、SDKには提供されていないのだが、WWDC 2013のサンプルコードにUIImage+ ImageEffects のcategoryが提供されていて、method呼ぶだけでその効果が実現できます。
#実現
https://developer.apple.com/downloads/index.action?name=WWDC%202013 下のiOS_UIImageEffects プロジェクトをダウンロード、UIImage+ImageEffects.hとUIImage+ImageEffects.mを自分のプロジェクトにコッピー.
あとはmethodを呼ぶだけ.

switch (self.imageIndex)
    {
        case 0:
           //普通
            effectImage = self.image;
            break;
        case 1:
           //ガラス風
            effectImage = [self.image applyLightEffect]; 
            break;
        case 2:
            // applyLightEffectより透明度が下がる
            effectImage = [self.image applyExtraLightEffect];
            break;
        case 3:
            //黒いガラス風
            effectImage = [self.image applyDarkEffect];
            break;
        case 4:
           //色指定
            effectImage = [self.image applyTintEffectWithColor:[UIColor blueColor]]; 
            break;
    }
    self.imageView.image = effectImage;

#参考

67
66
1

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
67
66

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?