繁体   English   中英

Peek和Pop 3D Touch - 非矩形预览文本演示

[英]Peek and Pop 3D Touch - non-rectangular previewingContext presentation

在指示暗示和弹出的提示期间(当所有其他开始模糊时,被按下的视图保持清晰的那一刻),我希望保持锐利的区域是非矩形的...准确的梯形。 怎么做到这一点?

在实现3D Touch时,我们都知道我们在方法中设置了previewingContext的sourceRect属性

- (UIViewController *)previewingContext:(id<UIViewControllerPreviewing>)previewingContext viewControllerForLocation:(CGPoint)location

我看起来像这样:

- (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;
}

一切都有效,完全像想象的那样。 但我不希望previewingContext.sourceRect的整个方块保持清晰! 我想切掉一个角落,留下一个梯形锐利。 有人有解决方案吗?

尝试

customVC.view.layer.cornerRadius = 10;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM