版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/sky_long_fly/article/details/87090444
先上效果图吧
这应该可以满足大多数需求情况了。
1.提示框离触发控件间隔
CGRect sourceRect = ((UIView *)sender).bounds;
sourceRect.origin.y -= 5;//修改整个内容和触发控件位子
tipsVC.popoverPresentationController.sourceRect = sourceRect;
2.提示框大小
tipsVC.preferredContentSize = CGSizeMake(contentWidth, contentHeight);
3.修改边框圆角
1.修改tipsVC view的圆角
tipsVC.view.layer.cornerRadius = cornerRadius;
tipsVC.view.layer.masksToBounds = YES;
2.添加下面设置
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
self.view.superview.clipsToBounds = NO;
}
4.修改三角形
//具体实现看代码吧
tipsVC.popoverPresentationController.popoverBackgroundViewClass = [UIPopBackgroundView class];
如果有疑问或者关于觉得不能做效果调试的请留言!!!
代码传送门