[英]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.