Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
67
Help us understand the problem. What are the problem?

More than 5 years have passed since last update.

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

概要

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;

参考

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
67
Help us understand the problem. What are the problem?