Commits

José Manuel Sánchez Peñarroja  committed 5f3dd41

Renamed some map annotation methods. Added background color method

  • Participants
  • Parent commits 6b1b187

Comments (0)

Files changed (7)

File Example/Example.xcworkspace/xcuserdata/josanchez.xcuserdatad/UserInterfaceState.xcuserstate

Binary file modified.

File bmf/ios/aspects/BMFControlRotateAspect.h

 /// 0.2 by default
 @property (nonatomic, assign) CGFloat animationDuration;
 
-/// 
+/// 0.95 by default
 @property (nonatomic, assign) CGFloat damping;
 
-///
+/// 0.05 by default
 @property (nonatomic, assign) CGFloat springVelocity;
 
 @end

File bmf/ios/aspects/BMFControlRotateAspect.m

 }
 
 - (void) setObject:(id)object {
-	BMFAssertReturn([object respondsToSelector:@selector(setSelected:)]);
 	BMFAssertReturn([object respondsToSelector:@selector(setHighlighted:)]);
 	BMFAssertReturn([object respondsToSelector:@selector(setTransform:)]);
 	
 	[super setObject:object];
 }
 
-//- (void) setSelected:(BOOL) selected {
-//	UIControl *control = self.object;
-//	[UIView animateWithDuration:self.animationDuration delay:0 usingSpringWithDamping:self.damping initialSpringVelocity:self.springVelocity options:0 animations:^{
-//		control.transform = CGAffineTransformMakeRotation(BMF_DEGREES_TO_RADIANS(90));
-//	} completion:^(BOOL finished){
-//		control.transform = CGAffineTransformIdentity;
-//	}];
-//}
-
 - (void) setHighlighted:(BOOL) highlighted {
 	if (highlighted) {
 		UIControl *control = self.object;

File bmf/ios/aspects/BMFControlScaleAspect.h

+//
+//  BMFControlScaleAspect.h
+//  Pods
+//
+//  Created by Jose Manuel Sánchez Peñarroja on 25/06/14.
+//
+//
+
+#import "BMFAspect.h"
+
+@interface BMFControlScaleAspect : BMFAspect
+
+/// 0.2 by default
+@property (nonatomic, assign) CGFloat animationDuration;
+
+/// 0.95 by default
+@property (nonatomic, assign) CGFloat damping;
+
+/// 0.05 by default
+@property (nonatomic, assign) CGFloat springVelocity;
+
+@end

File bmf/ios/aspects/BMFControlScaleAspect.m

+//
+//  BMFControlScaleAspect.m
+//  Pods
+//
+//  Created by Jose Manuel Sánchez Peñarroja on 25/06/14.
+//
+//
+
+#import "BMFControlScaleAspect.h"
+
+#import "BMF.h"
+
+@implementation BMFControlScaleAspect
+
+- (instancetype) init {
+	self = [super init];
+	if (self) {
+		_animationDuration = 0.2;
+		_damping = 0.95;
+		_springVelocity = 0.05;
+	}
+	return self;
+}
+
+- (void) setObject:(id)object {
+	BMFAssertReturn([object respondsToSelector:@selector(setHighlighted:)]);
+	BMFAssertReturn([object respondsToSelector:@selector(setTransform:)]);
+	
+	[super setObject:object];
+}
+
+- (void) setHighlighted:(BOOL) highlighted {
+	if (highlighted) {
+		UIControl *control = self.object;
+		
+		control.transform = CGAffineTransformMakeScale(0.1, 0.1);
+		
+		[UIView animateWithDuration:self.animationDuration delay:0 usingSpringWithDamping:self.damping initialSpringVelocity:self.springVelocity options:0 animations:^{
+			control.transform = CGAffineTransformIdentity;
+		} completion:nil];
+	}
+}
+
+@end

File bmf/ios/view controllers/BMFMapAnnotation.h

 
 - (MKPinAnnotationColor) pinColor;
 
-- (CGFloat) borderWidth;
-- (UIColor *) borderColor;
+- (UIColor *) annotationBackgroundColor;
+
+- (CGFloat) annotationBorderWidth;
+- (UIColor *) annotationBorderColor;
 
 @end

File bmf/ios/view controllers/BMFMapAnnotationFactory.m

 	
 	view.canShowCallout = annotation.canShowCallout;
 	if ([annotation respondsToSelector:@selector(annotationImage)]) view.image = annotation.annotationImage;
-	if ([annotation respondsToSelector:@selector(borderWidth)]) view.layer.borderWidth = annotation.borderWidth;
-	if ([annotation respondsToSelector:@selector(borderColor)]) view.layer.borderColor = annotation.borderColor.CGColor;
+	if ([annotation respondsToSelector:@selector(annotationBorderWidth)]) view.layer.borderWidth = annotation.annotationBorderWidth;
+	if ([annotation respondsToSelector:@selector(annotationBorderColor)]) view.layer.borderColor = annotation.annotationBorderColor.CGColor;
+	if ([annotation respondsToSelector:@selector(annotationBackgroundColor)]) view.backgroundColor = annotation.annotationBackgroundColor;
 	
 	if (self.calloutDelegate) {
 		view.leftCalloutAccessoryView = [self.calloutDelegate leftCalloutAccessoryView];