2016-09-06 10 views

答えて

3

は、次を使用して迅速に乗っ要求ボタンを作成することができます:あなたは(製品、ピックアップ、ドロップオフ)をカスタマイズしたいん

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

+0

UIをカスタマイズしたいですか?私はドキュメントで説明されている黒または白のバージョンを使用したくありません。基本的にUberの関数ターゲットをカスタムボタンに追加するにはどうすればよいですか? – jsanabria

+0

この場合、ディープリンクを使用して、任意のボタンスタイルを使用できます。次の例をご覧ください:https://developer.uber.com/docs/rides/deep-linking-action-setpickup –

2

デープリンク機能がほしいのであれば、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() 
} 
関連する問題