Fix action to handle filter change
This commit is contained in:
parent
c9e5f067e2
commit
7da2377f49
|
@ -29,7 +29,9 @@ class ViewController: UIViewController, UIImagePickerControllerDelegate, UINavig
|
|||
currentImageFilter = CIFilter(name: self.currentImageFilterName)
|
||||
|
||||
if let currentImage = currentImage {
|
||||
currentImageFilter.setValue(CIImage(image: currentImage), forKey: kCIInputImageKey)
|
||||
let newImage = CIImage(image: currentImage)
|
||||
|
||||
currentImageFilter.setValue(newImage, forKey: kCIInputImageKey)
|
||||
applyImageProcessing()
|
||||
}
|
||||
}
|
||||
|
@ -39,9 +41,6 @@ class ViewController: UIViewController, UIImagePickerControllerDelegate, UINavig
|
|||
return _currentFilterKeyAndValue()
|
||||
}
|
||||
|
||||
lazy var filterChoiceActions = _makeFilterChoiceActions()
|
||||
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
// Do any additional setup after loading the view, typically from a nib.
|
||||
|
@ -125,7 +124,7 @@ class ViewController: UIViewController, UIImagePickerControllerDelegate, UINavig
|
|||
@IBAction func changeFilter(_ sender: Any) {
|
||||
let controller = UIAlertController(title: "Choose a Filter", message: nil, preferredStyle: .actionSheet)
|
||||
|
||||
for action in filterChoiceActions {
|
||||
for action in _makeFilterChoiceActions() {
|
||||
controller.addAction(action)
|
||||
}
|
||||
|
||||
|
@ -158,7 +157,7 @@ class ViewController: UIViewController, UIImagePickerControllerDelegate, UINavig
|
|||
"CIVignette",
|
||||
].map({ UIAlertAction(title: $0, style: .default, handler: setFilter) })
|
||||
|
||||
actions.append(UIAlertAction(title: "Cancel", style: .cancel, handler: setFilter))
|
||||
actions.append(UIAlertAction(title: "Cancel", style: .cancel))
|
||||
|
||||
return actions
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue