總覽
此類別代表根據部分輸入的字串,列出完整查詢的地點建議。
資源 | |
NSAttributedString * | attributedFullText |
建議以 NSAttributedString 形式提供建議的完整說明。 | |
NSAttributedString * | attributedPrimaryText |
建議項目的主要文字,以 NSAttributedString 表示,通常是地點的名稱。 | |
NSAttributedString * | attributedSecondaryText |
建議 (NSAttributedString) 的次要文字,通常是地點的位置。 | |
NSString * | placeID |
代表建議地點 ID 的屬性,適用於 Place Details 要求。 | |
NSArray< NSString * > * | 類型 |
自動完成搜尋結果類型。 | |
NSNumber * | distanceMeters |
如果在要求的 GMSAutocompleteFilter 中指定有效起點,則起點與這項建議之間的直線距離 (以公尺為單位)。 |
資源說明文件
- (NSAttributedString*) attributedFullText [read, copy] |
建議以 NSAttributedString 形式提供建議的完整說明。
例如:「雪梨歌劇院,澳洲新南威爾斯州雪梨歌劇院」。
每個符合使用者輸入內容的文字範圍都會有一個 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) 的次要文字,通常是地點的位置。
例如:「Sydney, New South Wales, Australia」。
與使用者輸入內容相符的文字範圍含有 kGMSAutocompleteMatchAttribute
,例如 attributedFullText
。
可能為 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
中指定有效起點,則起點與這項建議之間的直線距離 (以公尺為單位)。