//
//  CalloutView.m
//  ArcGis
//
//  Created by Mac Book DQ02 on 16/3/23.
//  Copyright © 2016年 Xu Mengzhu. All rights reserved.
//

#import "CalloutView.h"

@implementation CalloutView

-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.objectNameLab = [[UILabel alloc]initWithFrame:CGRectMake(5, 5, 120, 15)];
        self.objectNameLab.backgroundColor = [UIColor colorWithRed:58/255.0 green:198/255.0 blue:100/255.0 alpha:1];
        NSLog(@"font = %@",self.objectNameLab.font);
        self.objectNameLab.textColor = [UIColor whiteColor];
        self.objectNameLab.textAlignment = NSTextAlignmentCenter;
        [self addSubview:self.objectNameLab];
        
        self.objectImgView = [[UIImageView alloc]initWithFrame:CGRectMake(5, 23, 120, 60)];
        self.objectImgView.image = [UIImage imageNamed:@"callout.png"];
        [self addSubview:self.objectImgView];
    }
    return self;
}

//点击气泡的视图，触发的函数，通知主控制器跳转到景点详情
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    if (![self.objectCode isEqualToString:@"no"]) {
        if ([self.delegate respondsToSelector:@selector(pushToDetailPage:andObjectName:)]) {
            [self.delegate pushToDetailPage:self.objectCode andObjectName:self.objectNameLab.text];
        }
    }
    
}


@end
