GMSAutocompletePrediction 클래스 참조

GMSAutocompletePrediction 클래스 참조

개요

이 클래스는 부분적으로 입력된 문자열을 기반으로 전체 쿼리의 예측을 나타냅니다.

속성

NSAttributedString * attributedFullText
 NSAttributedString 형태의 예상 검색어에 대한 전체 설명입니다.
NSAttributedString * attributedPrimaryText
 NSAttributedString으로 구성된 예상 검색어의 기본 텍스트이며, 대개 장소의 이름입니다.
NSAttributedString * attributedSecondaryText
 예상 검색어의 보조 텍스트로, 일반적으로 장소의 위치입니다. NSAttributedString.
NSString * placeID
 예상 검색어의 장소 ID를 나타내는 속성으로, 장소 세부정보 요청에 사용하기에 적합합니다.
NSArray< NSString * > * 유형
 이 자동 완성 결과의 유형입니다.
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으로 구성된 예상 검색어의 기본 텍스트이며, 대개 장소의 이름입니다.

예: '시드니 오페라 하우스'

사용자 입력과 일치하는 텍스트 범위에는 kGMSAutocompleteMatchAttribute이 있습니다(예: attributedFullText).

- (NSAttributedString*) attributedSecondaryText [read, copy]

예상 검색어의 보조 텍스트로, 일반적으로 장소의 위치입니다. NSAttributedString.

예: 'Sydney, New South Wales, Australia'.

사용자 입력과 일치하는 텍스트 범위에는 kGMSAutocompleteMatchAttribute이 있습니다(예: attributedFullText).

0일 수 있습니다.

- (NSString*) placeID [read, copy]

예상 검색어의 장소 ID를 나타내는 속성으로, 장소 세부정보 요청에 사용하기에 적합합니다.

- (NSArray<NSString *>*) 유형 [read, copy]

이 자동 완성 결과의 유형입니다.

유형은 NSString이며 유효한 값은 <https://developers.google.com/places/ios-sdk/supported_types>에 설명된 모든 유형입니다.

- (NSNumber*) distanceMeters [read, assign]

요청의 GMSAutocompleteFilter에 유효한 출발지가 지정된 경우 출발지와 이 예측 사이의 직선 거리(미터)입니다.