I have implemented peek and pop in most of my apps however sometimes after peeking or popping the window will no longer autorotate until the app is quit and reopened. Also, sometimes after peeking briefly the entire UI is non-interactable and the app must be quit. Does anyone have any possible idea what might be causing these issues? Is anyone else experiencing the same issues? I'm using Swift 2.0 on an iPhone 6s.
Autorotate Disabled by UIViewControllerPreviewing (3D Touch Peek/Pop)
Hi,
I have the same behaviour. After peeking in landscape mode, autorotate is no more active. Iphone 6s and ObjC.
Is there a solution or something wrong?
UPDATE:
I solved my problem:
I checked in traitCollectionDidChange the forceTouchCapability and registered for preview, if available. So I registered with every device-rotation my viewcontroller. Now I check first, if the controller is already registerd and all works fine. 🙂
@property BOOL touch3Dregister;
-(void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection {
[self check3DTouch];
}
- (void)check3DTouch {
if ([self.traitCollection respondsToSelector: @selector(forceTouchCapability)]) {
if (self.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable) {
if (!_touch3Dregister) {
self.myPreviewingContext = [self registerForPreviewingWithDelegate: self sourceView: self.view];
_touch3Dregister = YES;
}
}
else
{
[self unregisterForPreviewingWithContext:self.myPreviewingContext];
_touch3Dregister = NO;
}
}
}
I had this problem too.
Turned out I had a storyboard segue that handled peek/pop and the preview delegate. The presentation would be done twice and trigger this in the console:.
Warning: Attempt to present <AViewController: 0x1375c3ed0> on <ACollectionViewController: 0x13762feb0> which is already presenting (null)
The solution is to let the storyboard handle the peek/pop or do it via the delegate, not both.