我正在使用iOS的Uber SDK。如何在Swift中实现自定义Uber乘车请求按钮?我不想使用优步在他们的文档中使用的标准按钮。我想为它设计我自己的UI。Reference
发布于 2016-09-07 01:03:04
您可以使用以下内容在swift中创建乘车请求按钮:
let button = RideRequestButton()
let ridesClient = RidesClient()
let pickupLocation = CLLocation(latitude: 37.787654, longitude: -122.402760)
let dropoffLocation = CLLocation(latitude: 37.775200, longitude: -122.417587)
let builder = RideParametersBuilder().setPickupLocation(pickupLocation).setDropoffLocation(dropoffLocation, nickname: "Somewhere", address: "123 Fake St.")
ridesClient.fetchCheapestProduct(pickupLocation: pickupLocation, completion: {
product, response in
if let productID = product?.productID {
builder = builder.setProductID(productID)
button.rideParameters = builder.build()
button.loadRideInformation()
}
})您想要自定义什么(产品、拾取、丢弃)?根据您想要自定义的内容,您可以在以下文档中查看示例:https://developer.uber.com/docs/rides/ride-request-buttons
发布于 2016-09-07 04:25:02
如果你只想要深度链接功能,你可以使用RequestDeeplink类。类似于:
func setup() {
let rideParameters = RideParametersBuilder().build()
let deeplink = RequestDeeplink(rideParameters: rideParameters)
let button = UIButton()
button.addTarget(self, action: #selector(buttonAction), forControlEvents: .TouchUpInside)
}
func buttonAction() {
deeplink.execute()
}https://stackoverflow.com/questions/39342758
复制相似问题