Uh oh!
There was an error while loading. Please reload this page.
forked from efremidze/Cluster
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnnotationView.swift
More file actions
Latest commit
49 lines (43 loc) Β· 1.28 KB
/
Copy pathAnnotationView.swift
File metadata and controls
49 lines (43 loc) Β· 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//
// AnnotationView.swift
// Example
//
// Created by Lasha Efremidze on 10/9/18.
// Copyright Β© 2018 efremidze. All rights reserved.
//
import UIKit
import MapKit
import Cluster
classCountClusterAnnotationView:ClusterAnnotationView{
overridefunc configure(){
super.configure()
guardlet annotation = annotation as?ClusterAnnotationelse{return}
letcount= annotation.annotations.count
letdiameter=radius(for: count)*2
self.frame.size =CGSize(width: diameter, height: diameter)
self.layer.cornerRadius =self.frame.width /2
self.layer.masksToBounds =true
self.layer.borderColor =UIColor.white.cgColor
self.layer.borderWidth =1.5
}
func radius(for count:Int)->CGFloat{
if count <5{
return12
}elseif count <10{
return16
}else{
return20
}
}
}
classImageCountClusterAnnotationView:ClusterAnnotationView{
lazy varonce:Void={[unowned self]in
self.countLabel.frame.size.width -=6
self.countLabel.frame.origin.x +=3
self.countLabel.frame.origin.y -=6
}()
overridefunc layoutSubviews(){
super.layoutSubviews()
_ = once
}
}