JXLocPerImageVC.m 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. //
  2. // JXLocPerImageVC.m
  3. // shiku_im
  4. //
  5. // Created by Apple on 16/10/23.
  6. // Copyright © 2016年 Reese. All rights reserved.
  7. //
  8. #import "JXLocPerImageVC.h"
  9. @implementation JXLocPerImageVC
  10. -(id)initWithAnnotation:(id<BMKAnnotation>)annotation reuseIdentifier:(NSString *)reuseIdentifier{
  11. if (self = [super initWithAnnotation:annotation reuseIdentifier:reuseIdentifier]) {
  12. [self creatUI];
  13. }
  14. return self;
  15. }
  16. -(void)creatUI{
  17. //自定义图片view
  18. _headView = [[UIView alloc]initWithFrame:CGRectMake(-25, -60, 50, 60)];
  19. _headView.backgroundColor = [UIColor clearColor];
  20. _pointImage = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 50, 60)];
  21. _pointImage.image = [UIImage imageNamed:@"locationAcc2"];
  22. [_headView addSubview:_pointImage];
  23. _headImage = [[JXImageView alloc]initWithFrame:CGRectMake(5, 3, 40, 40)];
  24. _headImage.layer.cornerRadius = 20;
  25. _headImage.clipsToBounds = YES;
  26. [_headView addSubview:_headImage];
  27. [self addSubview:_headView];
  28. }
  29. -(void)selectAnimation{
  30. [UIView animateWithDuration:0.3 animations:^{
  31. _headView.frame = CGRectMake(-30, -70, 60, 70);
  32. _pointImage.frame = CGRectMake(0, 0, 60, 70);
  33. _headImage.layer.cornerRadius = 25;
  34. _headImage.frame = CGRectMake(6, 2, 48, 48);
  35. }];
  36. }
  37. -(void)cancelSelectAnimation{
  38. [UIView animateWithDuration:0.3 animations:^{
  39. _headView.frame = CGRectMake(-25, -60, 50, 60);
  40. _pointImage.frame = CGRectMake(0, 0, 50, 60);
  41. _headImage.frame = CGRectMake(5, 3, 40, 40);
  42. _headImage.layer.cornerRadius = 20;
  43. }];
  44. }
  45. -(void)setData:(NSDictionary*)data andType:(int)dataType{
  46. [g_server getHeadImageSmall:[NSString stringWithFormat:@"%lld",[data[@"userId"] longLongValue]] userName:data[@"nickname"] imageView:_headImage];
  47. }
  48. - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
  49. UIView *view = [super hitTest:point withEvent:event];
  50. if (view == nil) {
  51. CGPoint tempoint = [_headImage convertPoint:point fromView:self];
  52. if (CGRectContainsPoint(_headImage.bounds, tempoint))
  53. {
  54. view = _headImage;
  55. }
  56. }
  57. return view;
  58. }
  59. /*
  60. // Only override drawRect: if you perform custom drawing.
  61. // An empty implementation adversely affects performance during animation.
  62. - (void)drawRect:(CGRect)rect {
  63. // Drawing code
  64. }
  65. */
  66. @end