AutocompleteBaseViewController.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Copyright 2016 Google LLC. All rights reserved.
  3. *
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
  6. * file except in compliance with the License. You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software distributed under
  11. * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
  12. * ANY KIND, either express or implied. See the License for the specific language governing
  13. * permissions and limitations under the License.
  14. */
  15. #import <GooglePlaces/GooglePlaces.h>
  16. #import "GooglePlacesDemos/Support/BaseDemoViewController.h"
  17. static CGFloat const kButtonHeight = 44.f;
  18. static CGFloat const kButtonWidth = 200.f;
  19. static CGFloat const kButtonTopMargin = 100.f;
  20. /**
  21. * All other autocomplete demo classes inherit from this class. This class optionally adds a button
  22. * to present the autocomplete widget, and displays the results when these are selected.
  23. */
  24. @interface AutocompleteBaseViewController : BaseDemoViewController
  25. /** Filter to apply to autocomplete suggestions (can be nil). */
  26. @property(nonatomic, strong) GMSAutocompleteFilter *autocompleteFilter;
  27. /**
  28. * The |GMSPlaceField| for specifying explicit place details to be requested for the |GMSPlace|
  29. * result.
  30. */
  31. @property(nonatomic, assign) GMSPlaceField placeFields;
  32. /**
  33. * Build a UIButton to display the autocomplete widget and add it to the UI. This should be called
  34. * only if the demo requires such a button, e.g. demos for modal presentation of widgets would use
  35. * this, while a UITextField demo would not.
  36. *
  37. * @param selector The selector to send to self when the button is tapped.
  38. *
  39. * @return The UIButton which was added to the UI.
  40. */
  41. - (UIButton *)createShowAutocompleteButton:(SEL)selector;
  42. - (void)autocompleteDidSelectPlace:(GMSPlace *)place;
  43. - (void)autocompleteDidFail:(NSError *)error;
  44. - (void)autocompleteDidCancel;
  45. - (void)showCustomMessageInResultPane:(NSString *)message;
  46. - (void)resetViews;
  47. @end