Giter Site home page Giter Site logo

lippling / mtlocation Goto Github PK

View Code? Open in Web Editor NEW

This project forked from myell0w/mtlocation

1.0 1.0 0.0 240 KB

A Framework to add convenience-stuff for easier coping with CoreLocation/MapKit on iOS. It includes a custom UIBarButtonItem mimicing the Locate-Me-Button of the built-in Google Maps App

License: MIT License

C 10.86% Objective-C 89.14%

mtlocation's Introduction

Read Me

Currently Idle Currently searching for a location Currently receiving location updates Currently receiving heading updates

Description

These classes aim to mimic some of the functions of the built-in Google Maps App on iOS for you. Currently the library contains a simple Location Manager-Singleton that sends out notifications when CLLocationManager-Delegate-Methods are called and a UIBarButtonItem/UIButton that acts as a Locate-Me Button that behaves similar to the one in the Google Maps App. The switch from one mode to another is animated, just like in the Google Maps App.

It can also be customized to support Heading-Updates or not, by setting property headingEnabled.

Installation

Just copy over all .h and .m - Files to your project, as well as the images included. You may exchange the images with your own, but make sure to adopt frames and sizes in the code, if your images have a different size than the one provided (only if there are any visual quirks).

Usage

If you have problems getting the map-rotation to work, please refer to the following thread on StackOverflow: Rotating MapView

Update: MTLocation now provides the category-method [MKMapView sizeToFitTrackingModeFollowWithHeading] to automatically size to MapView.

You can use MTLocateMeBarButtonItem like this:

 // Configure Location Manager
 [MTLocationManager sharedInstance].locationManager.desiredAccuracy = kCLLocationAccuracyBest;
 [MTLocationManager sharedInstance].locationManager.distanceFilter = kCLDistanceFilterNone;
 [MTLocationManager sharedInstance].locationManager.headingFilter = 5; // 5 Degrees

 // Create MapView
 self.mapView = [[[MKMapView alloc] initWithFrame:CGRectZero] autorelease];
 [self.view addSubview:self.mapView];

 // create locate-me item, automatically prepare mapView
 self.locateMeItem = [UIBarButtonItem userTrackingBarButtonItemForMapView:self.mapView];
 // add target-action
 [self.locateMeItem addTarget:self action:@selector(myCustomSelector:) forControlEvents:UIControlEventTouchUpInside];
 // disable heading
 self.locateMeItem.headingEnabled = NO;
 
 // create array with ToolbarItems
 NSArray *toolbarItems = [NSArray arrayWithObject:self.locateMeItem];
 // set toolbar items
 [self.toolbar setItems:toolbarItems animated:NO];

mtlocation's People

Contributors

lippling avatar myell0w avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.