Open hsavit1 opened 9 years ago
Maybe it is not the best way to change the arrow size but you can use a custom arrow by implementing your own SMCalloutBackgroundView.
@interface CustomCalloutBackgroundView : SMCalloutBackgroundView
Set the image, anchorHeight, anchorMargin in the init and layout it as you need in the layoutSubviews.
- (id)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
self.containerView = [UIView new];
self.containerView.backgroundColor = [UIColor colorWithWhite:1.0f alpha:0.75f];
whiteArrowImage = [UIImage imageNamed:@"my_big_custom_arrow"];
self.anchorHeight = [NSNumber numberWithFloat:whiteArrowImage.size.height];
self.anchorMargin = whiteArrowImage.size.width;
self.arrowView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, whiteArrowImage.size.width, whiteArrowImage.size.height)];
self.arrowImageView = [[UIImageView alloc] initWithImage:whiteArrowImage];
[self addSubview:self.containerView];
[self addSubview:self.arrowView];
[self.arrowView addSubview:self.arrowImageView];
}
return self;
}
- (void)layoutSubviews {
self.containerView.frame = CGRectMake(0, 0, self.$width, self.$height - self.arrowView.$height);
self.arrowView.$x = self.arrowPoint.x;
self.arrowView.$y = self.containerView.$height;
self.arrowView.transform = CGAffineTransformIdentity;
}
Then set your custom background to your callout
[myCallout setBackgroundView:[[CustomCalloutBackgroundView alloc] init]]
@rousseauo is correct that a custom background will be needed to change the arrow, since the arrow is based on a static image. You could create your own static arrow image and use it instead if you want to draw it the same way.
Do you know how to encode an image into data as it is currently done in the project?
Btw- thanks for the blazing fast response!!
On Tuesday, May 5, 2015, Nick Farina notifications@github.com wrote:
@rousseauo https://github.com/rousseauo is correct that a custom background will be needed to change the arrow, since the arrow is based on a static image. You could create your own static arrow image and use it instead if you want to draw it the same way.
— Reply to this email directly or view it on GitHub https://github.com/nfarina/calloutview/issues/81#issuecomment-99310558.
Sent from Gmail Mobile
Take a look at SampleAssets/SystemGraphics/process_images.py to see how the included images are encoded.
I guess I'll have to open a py shell and try it out!
how can I do this? The arrow is hardcoded