lundi 4 juillet 2016

3D Touch - non-rectangular previewingContext presentation


During the indication hint of the peeking and popping (that moment when the view that gets pressed remains sharp while all else begins to blur), I want the area that remains sharp to be non-rectangular... trapezoidal, to be precise. How to accomplish this? In implementing 3D Touch, we all know that we set the sourceRect property of the previewingContext in the method - (UIViewController *)previewingContext:(id<UIViewControllerPreviewing>)previewingContext viewControllerForLocation:(CGPoint)location Mine looks something like this: - (UIViewController *)previewingContext:(id<UIViewControllerPreviewing>)previewingContext viewControllerForLocation:(CGPoint)location { if (CGRectContainsPoint(self.particularView.frame, location)) { previewingContext.sourceRect = self.particularView.frame; MyCustomViewController *customVC = [[MyCustomViewController customInit]; customVC.modalPresentationStyle = UIModalPresentationOverFullScreen; customVC.preferredContentSize = self.view.frame.size; return customVC; } return nil; } Everything works, totally as imagined. But I don't want the whole square of previewingContext.sourceRect to remain sharp! I want to cut off a corner, leaving a trapezoid sharp. Anyone have a solution?

Aucun commentaire:

Enregistrer un commentaire