Xcode9学习笔记53 - 遍历系统提供的所有滤镜

import UIKit
import CoreImage
class ViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()
        //获得系统内置滤镜的名称,并将滤镜名称放置在数组里
        let builtInFilters = CIFilter.filterNames(inCategory: kCICategoryBuiltIn)
        for filter in builtInFilters {//对滤镜名称的数组进行遍历
            let filter = CIFilter(name: filter as String)//根据滤镜的名称获得滤镜
            let attributes = filter!.attributes//获得滤镜所有的属性
            print("[\(String(describing: filter))]\n")//在控制台打印输出滤镜信息
            print(attributes)//在控制台打印输出滤镜的所有属性
            print("\n ------------------------------------------- \n")
        }
    }
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
}

  

posted on 2017-11-15 06:56  业余极客  阅读(178)  评论(0编辑  收藏  举报

导航