Place Selector Widget


Place Selector widget enables the user to choose his current location, place suggestions, and pinnable locations. This guide will cover how to add Place Picker View in your own view.

Where would it be useful?

You can use the Place Selector view to enable user to pick a place of his/her choice. Advantages:

  1. Reduces development time
  2. Free
  3. Includes the pinnable locations on a map
  4. Provides reverse-geocoded place suggestions

Adding Place Selector View To Your View

Step 1. Setup HTPlacePickerViewDelegate

HTPlacePickerViewDelegate helps you in recieving a callback when the user picks a location through our place selector view.


class YourViewController: UIViewController,HTLocationPickerViewDelegate {

    // implement delegate function to recieve an update when the user selects a place using place picker view 
    func didSelectPlace(place : HyperTrackPlace, pickerView:HTPlacePickerView){
            // get coordinates of place selected by user
            var locationCoordinate =  place.location?.toCoordinate2d()

     }

    // implement delegate function to recieve an update when the user cancels place selection
      func didCancelPlaceSelection(pickerView: HTPlacePickerView) {
        // you can remove your view here
    }
}
@interface YourViewController:UIViewController <HTPlacePickerViewDelegate>

@end

@implementation ViewController {
    - (void)didSelectPlaceWithPlace:(HyperTrackPlace * _Nonnull)place pickerView:(HTPlacePickerView * _Nonnull)pickerView{
            // get coordinates of place selected by user
           CLLocationCoordinate2D  coordinate =  [[place location]toCoordinate2d];
    }

    - (void)didCancelPlaceSelectionWithPickerView:(HTPlacePickerView * _Nonnull)pickerView{
            // you can remove your view here
    }
}

Step 2. Get Place Picker View

Get the place picker view HTPlacePickerView by calling getPlacePickerView with your predefined frame size. Add HTPlacePickerView to your view as subview. The frame of HTPlacePickerView automatically adjust itself to the frame size given by you.

let pickerView = HyperTrack.getPlacePickerView(frame:self.view.frame,delegate:self)
self.view.addSubview(pickerView)
HTPlacePickerView * placePickerView = [HyperTrack getPlacePickerViewWithFrame:self.view.frame delegate:self];
[self.view addSubview:placePickerView];

results matching ""

    No results matching ""