How to change margins in SMCalloutView

2019-06-10 21:30发布

问题:

I'm using Mapbox SDK and SMCalloutView

callout.view.frame = CGRectMake(0, 0, 300, 115);
SMCalloutView *smcallout = [[SMCalloutView alloc] init];
smcallout.contentView = callout.view;
[smcallout presentCalloutFromRect:smcallout.frame inLayer:annotation.layer constrainedToLayer:map.layer animated:YES];

How can i change margins from contentView to borders of calloutView?

回答1:

You have to overwrite the SMCalloutView as I did here:

https://github.com/Olinguito/YoIntervengoiOS/blob/master/Pods/SMCalloutView/SMCalloutView.m#L18

Hope it helps you.



回答2:

You can change the UIEdgeInsets of contentView.

[calloutView setContentViewInset:UIEdgeInsetsMake(0.0f, 0.0f, 0.0f, 0.0f)];