【发布时间】:2015-11-09 17:24:08
【问题描述】:
我想用paysbuy SDK实现支付功能....问题是它没有任何cancel选项,以便用户可以在支付成功后取消关闭操作。
默认情况下,SDK 提供了一种打开默认WebView 的方法,覆盖了整个屏幕。并且没有任何cancel 选项。
我只想通过在特定的view..或viewcontroller上加载付款来添加一个cancel按钮。我尝试在container视图中使用..加载container中的视图查看和container 视图外的cancel 按钮,但是当我尝试此过程时,它默认以全屏显示WebView。还尝试创建PopUP 但没有成功
那么,我如何将SDK 的webview 加载到我的view 的特定部分,以便我可以放置一个Cancel 按钮??
这是sdk提供的启动服务的方法
- (void) callServiceWithCurrentView :(UIViewController *) currentViewController
invoice:(NSString *)invoice
item:(NSString *)item
amount:(NSString *)amount
paypal_amount:(NSString *)paypal_amount
transferMethod:(NSString *)transferMethod
customerLanguage:(NSString *)customerLanguage
operator_name:(NSString *)operator_name
operator_email:(NSString *)operator_email
operator_mobile:(NSString *)operator_mobile
operator_address:(NSString *)operator_address
operator_detail:(NSString *)operator_detail;
在这里我们可以看到callServiceWithCurrentView 方法将目标显示为currentviewcontroller,所以我认为它在viewcontroller 上默认以full screen 模式加载....
这是我在 swift 中的实现方式
paysBuy?.callServiceWithCurrentView(self, invoice: "343434343", item: "App Fee", amount: "10", paypal_amount: "1", transferMethod: "1", customerLanguage: "E", operator_name: "PAYSBUY", operator_email: "abc@paysbuy.com", operator_mobile: "0888888888", operator_address: "PAYSBUY.COM", operator_detail: "PAYMENT")
还有一个委托方法,在成功或失败的情况下处理响应
extension PaysBuyHelper:PaysbuySDKDelegate{
func responseWithResult(result: String!, andInvoice invoice: String!) {
//here is the response of the payement
println(result)
println(invoice)
if result == "00" {
println("transaction complete and below is the invoice number")
println(invoice)
}else if result == "90"{
println("transaction incomplete information")
}
}
}
这是我所做的工作......https://drive.google.com/file/d/0Bzk4QVQhnqKmVno5NGdPUV9ITkE/view?usp=sharing
【问题讨论】:
-
您无法在 webview 上添加取消按钮,因为您无法控制它,我认为解决此问题的一个解决方案是您必须在函数并尝试将第二个 UIViewController 设为高度较小或类似的弹出窗口
-
@VarunNaharia 问题似乎是正在使用的 SDK 替换了根控制器。因此,当它接管时,无法控制屏幕上的内容。
-
@VarunNaharia 我试着按照你说的做,但效果不好......它显示我默认全屏......尝试在弹出窗口,容器视图上使用,正如 rory 在答案中所说......但是它们都不起作用
-
试试这个stackoverflow.com/questions/17758420/… 并尝试在每个视图顶部制作一个按钮
-
我已经尝试过使用容器视图...
标签: ios swift payment cancel-button