loganwright / SimpleCam

A Memory Efficient Drop In Replacement / Alternative for the Native UIImagePicker Camera
Mozilla Public License 2.0
210 stars 37 forks source link

Controls not drawing correctly on first load #22

Open mechanikalk opened 9 years ago

mechanikalk commented 9 years ago

The controls do not draw the images, only the text "capture", on the first load of the camera view after giving permission to the app to use the camera. It only happens on the first load after installation, but causes erroneous behavior which is very unfavorable especially if an image is used instead of capture because the user is presented with no controls. I have tried invoking [self loadControls], [self setNeedsDisplay] in view did load. Also tried [self.view bringSubviewToFront:btn]; in the load control method. I even tried asking for camera permission prior to invoking the simpleCam in the parent view controller. All to no avail. To simulate first install behavior and get the camera permission request you must uninstall app, change date of device forward more than 1 day, and than restart device.

The only way that I have gotten a "work around" is to create a flag firstTime that is set by the parent view controller which asks for camera permission before starting simpleCam. If the camera permission has just been granted the firstTime flag is set to YES. I then have simpleCam dismiss itself at the end of viewDidAppear, the parent view controller then reloads simpleCam only if the firstTime flag has been set. On the second load everything works fine. This double load only happens after the first install, but is currently the only way I can get the controls to draw.