GMSAutocompletePlacesuggestion 類別參考

GMSAutocompletePlaceSuggestion 類別參考資料

總覽

此類別代表根據部分輸入的字串,提供完整查詢的地點建議。

房源

NSAttributedString *attributedFullText
 建議的完整說明,格式為 NSAttributedString。
NSAttributedString *attributedPrimaryText
 建議的主要文字,其為 NSAttributedString,通常是地點的名稱。
NSAttributedString *attributedSecondaryText
 建議的次要文字,為 NSAttributedString,通常是地點位置。
NSString *placeID
 代表建議地點 ID 的屬性,適用於 Place Details 要求。
NSArray<NSString * >。類型
 自動完成搜尋結果類型。
NSNumber *distanceMeters
 如果在要求的 GMSAutocompleteFilter 中指定有效的起點,起點與這項建議之間的直線距離 (以公尺為單位)。

屬性說明文件

- (NSAttributedString*) attributedFullText [read, copy]

建議的完整說明,格式為 NSAttributedString。

例如:「雪梨歌劇院 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]

建議的次要文字,為 NSAttributedString,通常是地點位置。

例如:「澳洲新南威爾斯州雪梨」。

符合使用者輸入內容的文字範圍會使用 kGMSAutocompleteMatchAttribute,例如 attributedFullText

可能為 nil

- (NSString*) <地點 ID>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 中指定有效的起點,起點與這項建議之間的直線距離 (以公尺為單位)。