GMSAutocompletePrediction クラス リファレンス

GMSAutocompletePrediction クラス リファレンス

概要

このクラスは、部分的に入力された文字列に基づくクエリ全体の予測を表します。

プロパティ

NSAttributedString * attributedFullText
 NSAttributedString による予測の詳細な説明。
NSAttributedString * attributedPrimaryText
 NSAttributedString による予測のメインテキスト。通常は場所の名前になります。
NSAttributedString * attributedSecondaryText
 NSAttributedString による予測のセカンダリ テキストで、通常は場所の位置を示します。
NSString * placeID
 予測のプレイス ID を表すプロパティ。Place Details リクエストで使用するのに適しています。
NSArray< NSString * > * types
 このオートコンプリートの結果のタイプ。
NSNumber * distanceMeters
 リクエストの GMSAutocompleteFilter で有効な出発地が指定されている場合、出発地とこの予測の間の直線距離(メートル単位)。

(これらはメンバー関数ではないことに注意してください)。

NSString *constkGMSAutocompleteMatchAttribute
 GMSAutocompletePrediction attributeFullText 内の一致フラグメントの属性名。

- (NSString* const) kGMSAutocompleteMatchAttribute [related]

GMSAutocompletePrediction attributeFullText 内の一致フラグメントの属性名。


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

- (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 = [prediction.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 による予測のメインテキスト。通常は場所の名前になります。

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

ユーザー入力に一致するテキスト範囲には、attributedFullText などの kGMSAutocompleteMatchAttribute があります。

- (NSAttributedString*) attributedSecondaryText [read, copy]

NSAttributedString による予測のセカンダリ テキストで、通常は場所の位置を示します。

例: 「Sydney, New South Wales, Australia」

ユーザー入力に一致するテキスト範囲には、attributedFullText などの kGMSAutocompleteMatchAttribute があります。

nil にすることもできます。

- (NSString*) placeID [read, copy]

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

- (NSArray<NSString *>*) タイプ [read, copy]

このオートコンプリートの結果のタイプ。

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

- (NSNumber*) distanceMeters [read, assign]

リクエストの GMSAutocompleteFilter で有効な出発地が指定されている場合、出発地とこの予測の間の直線距離(メートル単位)。