initial
This commit is contained in:
+15
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// DriveRouteCustomAnnotationView.h
|
||||
// DDCategoryKit_Private
|
||||
// Created by DDIsFriend on 2023/2/3.
|
||||
|
||||
|
||||
#import <AMapNaviKit/MAMapKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface DriveRouteCustomAnnotationView : MAAnnotationView
|
||||
@property (nonatomic, strong)UILabel *customTextLabel;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// DriveRouteCustomAnnotationView.m
|
||||
// DDCategoryKit_Private
|
||||
// Created by DDIsFriend on 2023/2/3.
|
||||
|
||||
|
||||
#import "DriveRouteCustomAnnotationView.h"
|
||||
|
||||
@interface DriveRouteCustomAnnotationView ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation DriveRouteCustomAnnotationView
|
||||
|
||||
- (id)initWithAnnotation:(id <MAAnnotation>)annotation reuseIdentifier:(NSString *)reuseIdentifier{
|
||||
self = [super initWithAnnotation:annotation reuseIdentifier:reuseIdentifier];
|
||||
if (self) {
|
||||
[self addSubview:self.customTextLabel];
|
||||
|
||||
self.customTextLabel.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
[NSLayoutConstraint activateConstraints:@[
|
||||
[self.customTextLabel.heightAnchor constraintEqualToConstant:30],
|
||||
[self.customTextLabel.bottomAnchor constraintEqualToAnchor:self.topAnchor constant:0],
|
||||
[self.customTextLabel.centerXAnchor constraintEqualToAnchor:self.centerXAnchor],
|
||||
]];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
// MARK: <Lazy>
|
||||
- (UILabel *)customTextLabel{
|
||||
if (_customTextLabel == nil) {
|
||||
_customTextLabel = [[UILabel alloc] init];
|
||||
}
|
||||
return _customTextLabel;
|
||||
}
|
||||
@end
|
||||
Reference in New Issue
Block a user