Tag: 参数

从URL和传递参数打开iOS应用程序

链接应该打开应用程序。 我有这个工作。 我只是想知道如何传递一个参数。 假设url是“addappt://?code = abc”。 当视图控制器popup时,代码字段应该填充文本 – 等号后的字母。 我已经有一部分工作。 我使用以下(in app delegate.m) : NSArray *elements = [url.query componentsSeparatedByString:@"="]; NSString *key = [[elements objectAtIndex:0] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; val = [[elements objectAtIndex:1] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; (顺便说一下:val是在appdelegate.h中声明的 我也能够将val传递给视图控制器。 我唯一的问题是填充名为'code'的文本字段。 一旦应用程序被链接打开,你如何填充代码? 帮助赞赏。

将parameter passing给Objective C中的JSON Web服务

我试图调用一个web服务方法,并传递给它一个参数。 这是我的web服务方法: [WebMethod] [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public void GetHelloWorld() { Context.Response.Write("HelloWorld"); Context.Response.End(); } [WebMethod] [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public void GetHelloWorldWithParam(string param) { Context.Response.Write("HelloWorld" + param); Context.Response.End(); } 这是我的目标C代码: NSString *urlString = @"http://localhost:8080/MyWebservice.asmx/GetHelloWorld"; NSURL *url = [NSURL URLWithString:urlString]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; [request setHTTPMethod: @"POST"]; [request setValue:@"application/json" forHTTPHeaderField:@"Accept"]; [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"]; NSError *errorReturned = nil; […]

如何通过iOS中的参数将UITableView IndexPath传递给UIButton @selector?

我在UITableViewCells添加了UIButton 。 我有当用户点击button我们已经得到的indexpath使用NSMutableArray的值。 我用下面的来获取当前的IndexPath , [getMeButton addTarget:self action:@selector(resendTheErrorMessage:) forControlEvents:UIControlEventTouchUpInside]; -(void) resendTheErrorMessage:(id)sender { NSLog(@"SEnder: %@", sender); //NSLog(@"Index Path : %@", indexpath); } 任何人都可以请帮助我通过当前的indexpath UIButton's 。 提前致谢。 编辑: 这是我从NSLog()获得的输出 <UIButton: 0x864d420; frame = (225 31; 95 16); opaque = NO; tag = 105; layer = <CALayer: 0x864d570>>