Fix action to handle filter change

This commit is contained in:
CypherPoet 2019-01-27 19:09:25 -05:00
parent c9e5f067e2
commit 7da2377f49
1 changed files with 5 additions and 6 deletions

View File

@ -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
}