I want to ask about the proper implementation of 3D Touch. For example there UIViewController, which loads different from each other depending on the data being openly application. If as usual, it shows the same data, if in 3D Touch, then the other. I've done through NSUserDefaults
kept to a variable, that is, if the normal start is false, if in 3D Touch true. I do more with NSNotificationCenter
. It all worked, but it is not the correct implementation of this task. How best do I do that?
Please try following code for open detail view using 3D touch.
IBOutlet UIButton *btnDetail;
#pragma mark - Previewing delegate
- (UIViewController *)previewingContext:(id <UIViewControllerPreviewing>)previewingContext viewControllerForLocation:(CGPoint)location
{
UIViewController *detailVC = [self.storyboard instantiateViewControllerWithIdentifier:@"detail"];
detailVC.preferredContentSize = CGSizeMake(0.0, 568.0);
previewingContext.sourceRect = self.btnDetail.frame;
return detailVC;
}
- (void)previewingContext:(id <UIViewControllerPreviewing>)previewingContext commitViewController:(UIViewController *)viewControllerToCommit{
[self showViewController:viewControllerToCommit sender:self];
}