Help us understand the problem. What is going on with this article?

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

More than 5 years have passed since last update.

概要

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;

参考

huiping192
I'm a iOS developer~~ Developing apps so fun and i cannot get out with it.
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away