Add workaround for UIImagePickerController-bug which shows the statusBar

* the statusBar shows up when the UIImagePickerController opens
* the status bar does not disappear again when the UIImagePickerController is dismissed
This commit is contained in:
Jens Daemgen
2015-02-26 21:12:47 +01:00
committed by Andreas Linde
parent 3568b4cc1a
commit 6c27be621d

View File

@@ -67,6 +67,14 @@
@property (nonatomic) NSInteger selectedAttachmentIndex;
@property (nonatomic, strong) UITapGestureRecognizer *tapRecognizer;
/**
* Workaround for UIImagePickerController bug.
* The statusBar shows up when the UIImagePickerController opens.
* The status bar does not disappear again when the UIImagePickerController is dismissed.
* Therefore store the state when UIImagePickerController is shown and restore when viewWillAppear gets called.
*/
@property (nonatomic, strong) NSNumber *statusBarHidden;
@end
@@ -275,7 +283,11 @@
if (_text && self.textView.text.length == 0) {
self.textView.text = _text;
}
if (self.statusBarHidden) {
[[UIApplication sharedApplication] setStatusBarHidden:self.statusBarHidden.boolValue];
}
[self updateBarButtonState];
}
@@ -464,7 +476,9 @@
- (void)addPhotoAction:(id)sender {
if (_actionSheetVisible) return;
self.statusBarHidden = @([[UIApplication sharedApplication] isStatusBarHidden]);
// add photo.
UIImagePickerController *pickerController = [[UIImagePickerController alloc] init];
pickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;