概览
此类表示基于部分类型的字符串对完整查询的预测。
属性 | |
NSAttributedString * | attributedFullText |
作为 NSAttributedString 的预测结果的完整说明。 | |
NSAttributedString * | attributedPrimaryText |
预测结果的主要文本,采用 NSAttributedString 形式,通常是地点的名称。 | |
NSAttributedString * | attributedSecondaryText |
预测结果的次要文本,表示为 NSAttributedString,通常是地点的位置。 | |
NSString * | placeID |
表示预测结果的地点 ID 的属性,适合在地点详情请求中使用。 | |
NSArray< NSString * > * | 类型 |
此自动补全结果的类型。 | |
NSNumber * | distanceMeters |
起点与此预测结果之间的直线距离(如果在请求的 GMSAutocompleteFilter 中指定了有效出发地)。 | |
相关函数 | |
(请注意,这些并非成员函数。) | |
NSString *常量 | kGMSAutocompleteMatchAttribute |
GMSAutocompletePrediction AttributionFullText 中匹配 fragment 的属性名称。 |
好友和相关函数文档
- (NSString* const) kGMSAutocompleteMatchAttribute [related] |
GMSAutocompletePrediction
AttributionFullText 中匹配 fragment 的属性名称。
属性说明
- (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 形式,通常是地点的名称。
例如“悉尼歌剧院”。
与用户输入匹配的文本范围具有 kGMSAutocompleteMatchAttribute
,例如 attributedFullText
。
- (NSAttributedString*) attributedSecondaryText [read, copy] |
预测结果的次要文本,表示为 NSAttributedString,通常是地点的位置。
例如,“Sydney, New South Wales, Australia”。
与用户输入匹配的文本范围具有 kGMSAutocompleteMatchAttribute
,例如 attributedFullText
。
可以为零。
- (NSString*) placeID [read, copy] |
表示预测结果的地点 ID 的属性,适合在地点详情请求中使用。
- (NSArray<NSString *>*) 类型 [read, copy] |
此自动补全结果的类型。
类型是 NSString,有效值是在 <https://developers.google.com/places/ios-sdk/supported_types> 上记录的任何类型。
- (NSNumber*) distanceMeters [read, assign] |
起点与此预测结果之间的直线距离(如果在请求的 GMSAutocompleteFilter
中指定了有效出发地)。