iOS 程序间跳转传参(支付和地图)
两个APP之间的跳转是通过[[UIApplication sharedApplication] openURL:url]这种方式来实现的。
1.首先设置第一个APP的url地址
2.接着设置第二个APP的url地址
3.需要跳转的时候
NSString *urlString = [NSString stringWithFormat:@"AppJumpSecond://%@",textField.text];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];
我这里将textField的文字也传过去
同样的,在第二个页面也是如此
NSString *urlString = [NSString stringWithFormat:@"AppJumpFirst://%@",textField.text];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];
这样就能相互跳转了
4.处理传过去的数据
在上面传了textField的数据,接收时在AppDelegate的
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation方法里。
在AppDelegate里设置属性
@property (nonatomic, strong) RootViewController *rvc;
在didFinishLaunchingWithOptions方法里添加
self.rvc = [[RootViewController alloc] init];
UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:self.rvc];
self.window.rootViewController = nc;
添加代码块
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
self.rvc.textField.text = [[url host] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
return YES;
}
使得textField显示另一个页面传过来的数据。
iOS 程序间跳转传参(支付和地图)的更多相关文章
- 小程序页面跳转传参-this和that的区别-登录流程-下拉菜单-实现画布自适应各种手机尺寸
小程序页面跳转传参 根目录下的 app.json 文件 页面文件的路径.窗口表现.设置网络超时时间.设置多 tab { "pages": [ "pages/index/i ...
- 微信小程序页面跳转传参
1.传递参数方法 使用navigatior组件 <navigator url="/pages/pull/pull?title=lalla&name=cc" hov ...
- 微信小程序页面跳转传参方式
//实现跳转的A页面 jump: function () { let a = 1; let b = 2; wx.navigateTo({ url: '/page/vipOrder/vipOrder?d ...
- 三十七、小程序页面跳转传参参数值为url时参数丢失
当参数的值为url的时候,在options中的值没有参数“?”之后字符串被截取.例如:let url="http://baidu.com/?a=1&b=2"wx.navig ...
- 小程序页面跳转传参参数值为url时参数时 会出现丢失
当参数的值为url的时候, ?号 _ 下划线 等等 都会被 截取掉,看不到, 这样在 另一个页面 options中 截取的url就不完全 let url="http://ba ...
- 微信小程序~跳页传参
[1]需求: 点击商品,跳到相应商品详情页面 [2]代码: (1)商品列表页 <view class="goodsList"> <view wx:for=&quo ...
- 应用程序间跳转 (友盟SSO 授权 与系统自带的分享)
应用程序间跳转的应用场景 使用第三方用户登录,如微信登录,返回用户名和密码 需要用户授权,返回到调用程序,同时返回授权的用户名 应用程序推广,跳转到itunes并显示指定app下载页 第三方支付,跳转 ...
- vue路由(一个包含重定向、嵌套路由、懒加载的main.js如下)and 路由跳转传参的query和params的异同
import Vue from 'vue'import VueRouter from 'vue-router'import App from './App'Vue.use(VueRouter)cons ...
- vue 页面跳转传参
页面之间的跳转传参,正常前端js里写 window.location.href="xxxxx?id=1" 就可以了: 但是vue不一样 需要操作的是路由history,需要用到 V ...
随机推荐
- permutation求全排列
include <iostream> #include <string> using namespace std; void swap(char &c1, char & ...
- repeat a string in java
if I want to repeat "hello" four times as a new string-> "hellohellohellohello&quo ...
- 15分钟快速开发一个kissy组件(流程篇)
Step1: 安装kissy gallery组件工具 npm install yo grunt-cli -g npm install generator-kissy-gallery -g 请确保本地带 ...
- ios 做的一个三个数求平均数 最大数 最小数
#import "ViewController.h" @interface ViewController ()@property (weak, nonatomic) IBOutle ...
- 微信支付WxpayAPI_php_v3(一)sdk简介与错误修改
经过断断续续将近一周的时间终于把微信支付调通了. 这里总结一下,算是给后来者有个指引.少踩坑!!!! 开发语言:php5.5 语言框架:laravel5.2 微信sdk:WxpayAPI_php_v3 ...
- perl中调用cgi
来源: http://www.cnblogs.com/itech/archive/2012/09/23/2698856.html 参考:http://www.willmaster.com/librar ...
- fszipx.exe
来源:http://www.funduc.com/fszipx.htm 是个免费软件,用于把.zip转化为.exe自解压文件. COPY /B "C:\Tools\FsZipX\FsZipX ...
- ios 贝塞尔画图
CGContextRef context = UIGraphicsGetCurrentContext(); //写文字 CGContextSetRGBFillColor(context, 1, 0, ...
- Alamofire 框架浅析
下面是 Github 主页上对 Alamofire 的描述 Elegant HTTP Networking in Swift 为什么这次我选择阅读 Alamofire 的源代码而不是 AFNetwor ...
- 使用Theos做一个简单的Mobile Substrate Tweak
01 January 2014 Mobile Substrate和Theos Mobile Substrate是Cydia的作者Jay Freeman (@saurik)的另外一个牛X的作品,也叫Cy ...