GMSAutocompletePlaceSuggestion クラス リファレンス

GMSAutocompletePlaceSuggestion クラス リファレンス

概要

このクラスは、部分的に型指定された文字列に基づく、完全なクエリの場所の候補を表します。

プロパティ

NSAttributedString * attributedFullText
 NSAttributedString としての提案の詳細な説明。
NSAttributedString * attributedPrimaryText
 候補の NSAttributedString 形式のメインテキスト。通常は場所の名前になります。
NSAttributedString * attributedSecondaryText
 候補の 2 番目のテキスト。NSAttributedString 形式で指定します。通常は場所の位置です。
NSString * placeID
 候補のプレイス ID を表すプロパティ。Place Details リクエストで使用するのに適しています。
NSArray< NSString * > * types
 オートコンプリートの結果の型。
NSNumber * distanceMeters
 リクエストの GMSAutocompleteFilter で有効な起点が指定されている場合の、原点とこの候補との間の直線距離(メートル単位)。

プロパティのドキュメント

- (NSAttributedString*) attributedFullText [read, copy]

NSAttributedString としての提案の詳細な説明。

例: 「Sydney Opera House, Sydney, New South Wales, Australia」。

ユーザー入力に一致するすべてのテキスト範囲に kGMSAutocompleteMatchAttribute があります。たとえば、enumerateAttribute を使用すると、すべての一致を太字にできます。

   UIFont *regularFont = [UIFont systemFontOfSize:[UIFont labelFontSize]];
   UIFont *boldFont = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]];
   NSMutableAttributedString *bolded = [suggestion.attributedFullText mutableCopy];
   [bolded enumerateAttribute:kGMSAutocompleteMatchAttribute
                      inRange:NSMakeRange(0, bolded.length)
                      options:0
                   usingBlock:^(id value, NSRange range, BOOL *stop) {
                     UIFont *font = (value == nil) ? regularFont : boldFont;
                     [bolded addAttribute:NSFontAttributeName value:font range:range];
                   }];
   label.attributedText = bolded;
 
- (NSAttributedString*) attributedPrimaryText [read, copy]

候補の NSAttributedString 形式のメインテキスト。通常は場所の名前になります。

(例: 「シドニー オペラハウス」)。

ユーザー入力に一致するテキスト範囲に kGMSAutocompleteMatchAttribute があります(例: attributedFullText)。

- (NSAttributedString*) attributedSecondaryText [read, copy]

候補の 2 番目のテキスト。NSAttributedString 形式で指定します。通常は場所の位置です。

例: 「Sydney, New South Wales, Australia」。

ユーザー入力に一致するテキスト範囲に kGMSAutocompleteMatchAttribute があります(例: attributedFullText)。

nil の場合もあります。

- (NSString*) placeID [read, copy]

候補のプレイス ID を表すプロパティ。Place Details リクエストで使用するのに適しています。

- (NSArray<NSString *>*) types [read, copy]

オートコンプリートの結果の型。

型は NSString です。有効な値は、<https://developers.google.com/places/ios-sdk/supported_types> に記載されている任意の型です。

- (NSNumber*) distanceMeters [read, assign]

リクエストの GMSAutocompleteFilter で有効な起点が指定されている場合の、原点とこの候補との間の直線距離(メートル単位)。