我想创建一个nsobject,它将拥有我的所有方法,这些方法将用于与我的php脚本交谈并从我的数据库获取数据。nsObject使用ASIHTTPRequests
我想使用ASIHTTPRequest包装为我做这件事,但我不知道如何构造这个nsobject,因为会有几个方法调用不同的PHP脚本(或在不同的功能相同的PHP)。
我在哪里得到升技是在考虑从视图中调用nsobject方法的地方,我想从数据库中显示数据,因为我不知道如何使用 - (void)获取数据到视图)requestFinished:(ASIHTTPRequest *)请求{方法。
例如将NSObject的是这样
//...
-(IBAction) method1
{
NSURL *url = [NSURL URLWithString:@"http://allseeing-i.com"];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setDelegate:self];
[request startAsynchronous];
}
-(IBAction) method2
{
NSURL *url = [NSURL URLWithString:@"http://allseeing-i.com"];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setDelegate:self];
[request startAsynchronous];
}
-(IBAction) method3
{
NSURL *url = [NSURL URLWithString:@"http://allseeing-i.com"];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setDelegate:self];
[request startAsynchronous];
}
//Then catch each method request with one
- (void)requestFinished:(ASIHTTPRequest *)request{ //etc
//and use one failed request
- (void)requestFailed:(ASIHTTPRequest *)request{ //etc
或者你把你要显示的信息的视图里面的requestFinished方法?
是的,这是有道理的。我对uitableviews的经验有限,我正在越来越好,只是在什么时候以及何处传递数据等等,这让我ab ab不已。 –