diff --git a/Example/WPMediaPicker/DemoViewController.m b/Example/WPMediaPicker/DemoViewController.m index 80069c64..306fba59 100644 --- a/Example/WPMediaPicker/DemoViewController.m +++ b/Example/WPMediaPicker/DemoViewController.m @@ -132,7 +132,11 @@ - (UITextField *)quickInputTextField { } - (void)setupMediaKeyboardForInputField { - self.mediaInputViewController = [[WPInputMediaPickerViewController alloc] init]; + if (self.mediaInputViewController) { + [self.mediaInputViewController removeFromParentViewController]; + } else { + self.mediaInputViewController = [[WPInputMediaPickerViewController alloc] init]; + } if ([self.options[MediaPickerOptionsScrollInputPickerVertically] boolValue]) { self.mediaInputViewController.scrollVertically = YES; } diff --git a/Pod/Classes/WPMediaCapturePreviewCollectionView.m b/Pod/Classes/WPMediaCapturePreviewCollectionView.m index 1dfc68e9..991501f3 100644 --- a/Pod/Classes/WPMediaCapturePreviewCollectionView.m +++ b/Pod/Classes/WPMediaCapturePreviewCollectionView.m @@ -26,7 +26,7 @@ - (void)commonInit { [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deviceOrientationDidChange:) name:UIDeviceOrientationDidChangeNotification object:nil]; - + self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; self.backgroundColor = [UIColor blackColor]; _sessionQueue = dispatch_queue_create("org.wordpress.WPMediaCapturePreviewCollectionView", DISPATCH_QUEUE_SERIAL); _previewView = [[UIView alloc] initWithFrame:self.bounds]; @@ -49,6 +49,7 @@ - (void)dealloc - (void)layoutSubviews { [super layoutSubviews]; + self.previewView.frame = self.bounds; self.captureVideoPreviewLayer.frame = self.previewView.bounds; } @@ -101,10 +102,11 @@ - (void)startCapture } if (!self.session.isRunning || !self.captureVideoPreviewLayer.connection.enabled){ [self.session startRunning]; + AVCaptureVideoPreviewLayer * newLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:self.session]; dispatch_async(dispatch_get_main_queue(), ^{ if (!self.captureVideoPreviewLayer || !self.captureVideoPreviewLayer.connection.enabled) { [self.captureVideoPreviewLayer removeFromSuperlayer]; - self.captureVideoPreviewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:self.session]; + self.captureVideoPreviewLayer = newLayer; CALayer *viewLayer = self.previewView.layer; self.captureVideoPreviewLayer.videoGravity = AVLayerVideoGravityResizeAspectFill; self.captureVideoPreviewLayer.frame = viewLayer.bounds;