public
Created

  • Download Gist
MKMapView+Additions.h
Objective-C
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
//
// MKMapView+Additions.h
// ParkingMobility
//
// Created by Michael Nachbaur on 10-09-12.
// Copyright 2010 Decaf Ninja Software. All rights reserved.
//
 
#import <MapKit/MapKit.h>
 
@interface MKMapView (Additions)
 
- (UIImageView*)googleLogo;
 
@end
MKMapView+Additions.m
Objective-C
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
//
// MKMapView+Additions.m
// ParkingMobility
//
// Created by Michael Nachbaur on 10-09-12.
// Copyright 2010 Decaf Ninja Software. All rights reserved.
//
 
#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
MyViewController.m
Objective-C
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/*** SNIP ***/
 
#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

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.