MAAnnotationView.h.svn-base 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. //
  2. // MAAnnotationView.h
  3. // MAMapKit
  4. //
  5. // Created by AutoNavi.
  6. // Copyright (c) 2013年 Amap. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. ///annotationView拖动状态
  10. typedef NS_ENUM(NSInteger, MAAnnotationViewDragState) {
  11. MAAnnotationViewDragStateNone = 0, ///< 静止状态
  12. MAAnnotationViewDragStateStarting, ///< 开始拖动
  13. MAAnnotationViewDragStateDragging, ///< 拖动中
  14. MAAnnotationViewDragStateCanceling, ///< 取消拖动
  15. MAAnnotationViewDragStateEnding ///< 拖动结束
  16. };
  17. @protocol MAAnnotation;
  18. ///标注view
  19. @interface MAAnnotationView : UIView
  20. ///复用标识
  21. @property (nonatomic, readonly) NSString *reuseIdentifier;
  22. ///z值,大值在上,默认为0
  23. @property (nonatomic, assign) NSInteger zIndex;
  24. ///关联的annotation
  25. @property (nonatomic, strong) id <MAAnnotation> annotation;
  26. ///显示的image
  27. @property (nonatomic, strong) UIImage *image;
  28. ///默认情况下,annotation view的中心位于annotation的坐标位置,可以设置centerOffset改变view的位置,正的偏移使view朝右下方移动,负的朝左上方,单位是像素
  29. @property (nonatomic) CGPoint centerOffset;
  30. ///默认情况下,弹出的气泡位于view正中上方,可以设置calloutOffset改变view的位置,正的偏移使view朝右下方移动,负的朝左上方,单位是像素
  31. @property (nonatomic) CGPoint calloutOffset;
  32. ///默认为YES,当为NO时view忽略触摸事件
  33. @property (nonatomic, getter=isEnabled) BOOL enabled;
  34. ///annotationView是否突出显示(一般不需要手动设置)
  35. @property (nonatomic, getter=isHighlighted) BOOL highlighted;
  36. ///设置是否处于选中状态, 外部如果要选中请使用mapView的selectAnnotation方法
  37. @property (nonatomic, getter=isSelected) BOOL selected;
  38. ///设置是否可以显示callout,默认为NO
  39. @property (nonatomic) BOOL canShowCallout;
  40. ///显示在气泡左侧的view
  41. @property (nonatomic, strong) UIView *leftCalloutAccessoryView;
  42. ///显示在气泡右侧的view
  43. @property (nonatomic, strong) UIView *rightCalloutAccessoryView;
  44. ///是否支持拖动,默认为NO
  45. @property (nonatomic, getter=isDraggable) BOOL draggable;
  46. ///当前view的拖动状态
  47. @property (nonatomic) MAAnnotationViewDragState dragState;
  48. /**
  49. * @brief 初始化并返回一个annotation view
  50. * @param annotation 关联的annotation对象
  51. * @param reuseIdentifier 如果要复用view,传入一个字符串,否则设为nil,建议重用view
  52. * @return 初始化成功则返回annotation view,否则返回nil
  53. */
  54. - (id)initWithAnnotation:(id <MAAnnotation>)annotation reuseIdentifier:(NSString *)reuseIdentifier;
  55. /**
  56. * @brief 当从reuse队列里取出时被调用
  57. */
  58. - (void)prepareForReuse;
  59. /**
  60. * @brief 设置是否处于选中状态, 外部如果要选中请使用mapView的selectAnnotation方法
  61. * @param selected 是否选中
  62. * @param animated 是否动画设置
  63. */
  64. - (void)setSelected:(BOOL)selected animated:(BOOL)animated;
  65. /**
  66. * @brief 当前view的拖动状态
  67. * @param newDragState 要设置的拖放状态
  68. * @param animated 是否动画设置
  69. */
  70. - (void)setDragState:(MAAnnotationViewDragState)newDragState animated:(BOOL)animated;
  71. @end