Maps SDK สำหรับ iOS v3.10.0 รุ่นเบต้ามีฟีเจอร์ใหม่ดังต่อไปนี้ให้คุณได้ลองใช้
- การปรับแต่งแผนที่/การจัดรูปแบบในระบบคลาวด์
- การปรับแต่งเส้นประกอบ: เส้นประกอบที่มีการประทับตรา
การปรับแต่งแผนที่/การจัดรูปแบบในระบบคลาวด์ (เบต้า)
ตอนนี้คุณสามารถสร้างรูปแบบที่กำหนดเอง และใช้โทเค็นเพื่อกำหนดรูปแบบเหล่านั้นให้กับแผนที่ใน แอปและเว็บไซต์ สำหรับข้อมูลเพิ่มเติม โปรดดู ภาพรวมการปรับแต่ง Maps ใน iOS
การปรับแต่งเส้นประกอบ: เส้นประกอบที่มีการประทับตรา
คุณตั้งค่าลักษณะเส้นประกอบเป็นพื้นผิวบิตแมปซ้ำได้โดยใช้ GMSTextureStyle
รูปภาพครอบคลุมเส้นทั้งหมด แต่จะถูกตัดออกรอบๆ จุดสิ้นสุดและจุดยอด
หากต้องการสร้างเส้นประกอบที่ประทับตรา ให้สร้าง GMSStampStyle
เป็น GMSTextureStyle
จากนั้นตั้งค่าคุณสมบัตินี้ในออบเจ็กต์ตัวเลือกของรูปร่างโดยใช้ stampStyle
ดังต่อไปนี้
Swift
let path = GMSMutablePath() path.addLatitude(-37.81319, longitude: 144.96298) path.addLatitude(-31.95285, longitude: 115.85734) let polyline = GMSPolyline(path: path) let redWithStamp = GMSStrokeStyle.solidColor(.red) let image = UIImage(named: "imageFromBundleOrAsset")! // Image could be from anywhere redWithStamp.stampStyle = GMSTextureStyle(image: image) let span = GMSStyleSpan(style: redWithStamp) polyline.spans = [span] polyline.map = mapView
Objective-C
GMSMutablePath *path = [GMSMutablePath path]; [path addLatitude:-37.81319 longitude:144.96298]; [path addLatitude:-31.95285 longitude:115.85734]; GMSPolyline *polyline = [GMSPolyline polylineWithPath:path]; GMSStrokeStyle *redWithStamp = [GMSStrokeStyle solidColor:[UIColor redColor]]; UIImage *image = [UIImage imageNamed:@"imageFromBundleOrAsset"]; // Image could be from anywhere redWithStamp.stampStyle = [GMSTextureStyle textureStyleWithImage:image]; GMSStyleSpan *span = [GMSStyleSpan spanWithStyle:redWithStamp]; polyline.spans = @[span]; polyline.map = mapView;