finn-no / Finjinon

Custom iOS camera optimized for taking a sequence of photos quickly and/or selecting from an image picker
MIT License
58 stars 16 forks source link

Fix for pickerButton that ends up behind the previewView in some cases #26

Closed PWFinn closed 6 years ago

PWFinn commented 6 years ago

What?

view.bringSubview(toFront: pickerButton!) is ran in updateImagePickerButton() to ensure that the the button is always on top (visible), regardless of when then imagePickerAdapter's didSet creates the pickerButton.

Why?

The pickerButton is hidden behind the previewView if a custom imagePickerAdapter is set before viewDidAppear.

Footnote: Setting subviews in viewDidAppear is not a great solution... It's a fix to respect Safe Areas (known after viewDidAppear) for iPhone X in particular. Setting positions constrained to Safe Area would allow for more flexibility with Auto Layout, and thus creating the subViews in viewDidLoad/viewWillAppear would be possible again.