概览
此类表示基于部分类型字符串的完整查询的地点建议。
属性 | |
NSAttributedString * | attributedFullText |
NSAttributedString 形式的建议完整说明。 | |
NSAttributedString * | attributedPrimaryText |
建议的主要文本,以 NSAttributedString 的形式表示,通常是地点的名称。 | |
NSAttributedString * | attributedSecondaryText |
建议的次要文本,以 NSAttributedString 的形式表示,通常是地点的位置。 | |
NSString * | placeID |
表示建议的地点 ID 的属性,适合在地点详情请求中使用。 | |
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 的形式表示,通常是地点的位置。
例如“澳大利亚新南威尔士州悉尼”。
与用户输入匹配的文本范围具有 kGMSAutocompleteMatchAttribute
,例如 attributedFullText
。
可能会是 nil
。
- (NSString*) placeID [read, copy] |
表示建议的地点 ID 的属性,适合在地点详情请求中使用。
- (NSArray<NSString *>*) 类型 [read, copy] |
自动补全结果类型。
类型是 NSString,有效值是 <https://developers.google.com/places/ios-sdk/supported_types> 上记录的任何类型。
- (NSNumber*)distanceMetersdistanceMeters [read, assign] |
起点与此建议之间的直线距离(以米为单位),前提是请求的 GMSAutocompleteFilter
中指定了有效起点。