ข้อมูลอ้างอิงของชั้นเรียน GMSAutocompletePlaceRecommendationion

การอ้างอิงคลาส GMSAutocompletePlaceSuggestion

ภาพรวม

คลาสนี้จะแสดงคำแนะนำตำแหน่งของข้อความค้นหาแบบเต็มตามสตริงที่พิมพ์บางส่วน

ที่พัก

NSAttributedString *attributedFullText
 คำอธิบายแบบเต็มของคำแนะนำเป็น NSAttributedString
NSAttributedString *attributedPrimaryText
 ข้อความหลักของคำแนะนำที่เป็น NSAttributedString โดยปกติแล้วจะเป็นชื่อของสถานที่
NSAttributedString *attributedSecondaryText
 ข้อความรองของคำแนะนำที่เป็น NSAttributedString โดยปกติแล้วจะเป็นตำแหน่งของสถานที่
NSString *placeID
 พร็อพเพอร์ตี้ที่แสดงรหัสสถานที่ของคำแนะนำ เหมาะสำหรับใช้ในคำขอรายละเอียดสถานที่
NSArray< NSString * > *ประเภท
 ประเภทผลลัพธ์ที่เป็นการเติมข้อความอัตโนมัติ
หมายเลข NS *distanceMeters
 ระยะห่างของเส้นตรงในหน่วยเมตรระหว่างต้นทางกับคำแนะนำนี้ หากระบุต้นทางที่ถูกต้องใน GMSAutocompleteFilter ของคำขอ

เอกสารเกี่ยวกับพร็อพเพอร์ตี้

- (NSAttributedString*) attributedFullText [read, copy]

คำอธิบายแบบเต็มของคำแนะนำเป็น NSAttributedString

เช่น "Sydney Opera House, ซิดนีย์ นิวเซาท์เวลส์ ออสเตรเลีย"

ช่วงข้อความทุกช่วงที่ตรงกับอินพุตของผู้ใช้จะมี 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 โดยปกติแล้วจะเป็นชื่อของสถานที่

เช่น "Sydney Opera House"

ช่วงข้อความที่ตรงกับอินพุตของผู้ใช้จะมี kGMSAutocompleteMatchAttribute เช่น attributedFullText

- (NSAttributedString*) attributedSecondaryText [read, copy]

ข้อความรองของคำแนะนำที่เป็น NSAttributedString โดยปกติแล้วจะเป็นตำแหน่งของสถานที่

เช่น "ซิดนีย์ นิวเซาท์เวลส์ ออสเตรเลีย"

ช่วงข้อความที่ตรงกับอินพุตของผู้ใช้จะมี kGMSAutocompleteMatchAttribute เช่น attributedFullText

อาจเป็นnil

- (NSString*) placeID [read, copy]

พร็อพเพอร์ตี้ที่แสดงรหัสสถานที่ของคำแนะนำ เหมาะสำหรับใช้ในคำขอรายละเอียดสถานที่

- (NSArray<NSString *>*) ประเภท [read, copy]

ประเภทผลลัพธ์ที่เป็นการเติมข้อความอัตโนมัติ

ประเภทคือ NSString ค่าที่ถูกต้องคือประเภทใดก็ได้ที่บันทึกไว้ใน <https://developers.google.com/places/ios-sdk/supported_types>

- (NSNumber*) distanceMeters [read, assign]

ระยะห่างของเส้นตรงในหน่วยเมตรระหว่างต้นทางกับคำแนะนำนี้ หากระบุต้นทางที่ถูกต้องใน GMSAutocompleteFilter ของคำขอ