Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@NachoMan
Created September 12, 2010 20:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NachoMan/576388 to your computer and use it in GitHub Desktop.
Save NachoMan/576388 to your computer and use it in GitHub Desktop.
//
// 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
// 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
/*** 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment