#import "MKMapView+Additions.h"
@implementation MKMapView (Additions)
- (UIImageView*)googleLogo {
UIImageView *imgView = nil;
for (UIView *subview in self.subviews) {
if ([subview isMemberOfClass:[UIImageView class]]) {
imgView = (UIImageView*)subview;
break;
}
}
return imgView;
}
@end
#import "MKMapView+Additions.h"
- (void)viewDidAppear:(BOOL)animated {
[self relocateGoogleLogo];
}
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
[self relocateGoogleLogo];
}
- (void)relocateGoogleLogo {
UIImageView *logo = [_mapView googleLogo];
if (logo == nil)
return;
CGRect frame = logo.frame;
frame.origin.y = _toolbar.frame.origin.y - frame.size.height - frame.origin.x;
logo.frame = frame;
}
@end
移动之前:
改动之后: