How to perform a segue in the background when RideRequestButton is pressed?

时间:2016-07-05 20:40:06

标签: ios swift uber-api

I'm using the Uber SDK for iOS and more specifically a RideRequestWidget to allow my users to call an uber. I'm curious is if there is any way you could perform a segue in the background when the RideRequestButton is pressed.

ex: I have the RideRequestButton on one view controller and when my users are done with Uber and have arrived they need to be directed back to a different view controller than where they started. Does anyone have an idea on how to do this or a different way to do it?

Thank you so much!

1 个答案:

答案 0 :(得分:0)

如果我正确理解您,当用户解除Ride Request Widget时,您是否希望将它们带到与其启动位置不同的屏幕上?

我看到了两个选项来实现这个目标:

1)在您拥有按钮的视图控制器中,符合ModalViewControllerDelegate协议。使用RideRequestButton创建RideRequestViewRequestingBehavior时,请将视图控制器设置为rideRequestViewRequestingBehaviorObject.modalRideRequestViewController的委托,因此当用户解除Ride Request Widget时,modalViewControllerDidDismiss委托方法将为调用,你可以在那时做自定义segue。

2)您可以创建自己的自定义视图控制器,其中包含RideRequestView,您可以在其中提供控件以允许用户关闭视图控制器。这样你就可以控制下一步的去向。你仍然可以使用RideRequestButton,你只需要创建一个符合RideRequesting协议的自定义类,然后用它初始化RideRequestButton。如果您采用这种方法,则需要单独处理登录,因为RideRequestView没有为您处理(由RideRequestViewController处理)