首先......如果没有人可以回答这个问题,那没关系......
因为我不知道如何在正确的描述中问这个问题
我的程序是从 URL 获取 plist 数据并将其显示在 iphone tableview 上
我的同事给了我两个 URL 来获取 plist 数据
所以我有两个表视图(tableview1,tableview2)
两个 URL(URL1,URL2)
我的tableview1通过URL1得到一个plist1,并且tableview1在前 3 行中有 3 个内容
例如(第 0 行 id1),(第 1 行 id2),(第 2 行 id3)
当我选择 row0 时,它将跳转到tableview2并在导航栏上显示标题id1
到目前为止,我能做到...
但在tableview2,它需要一个 URL,如:www.URL2.php?id=1 =>这意味着......
我必须在 URL2 之后添加我的 tableview 标题
获得与 id 1 相关的正确 plist
我的问题是....... URL2是静态的,如何让它像动态一样获得正确的 URL 地址???
嗯.....第一次我以为我的同事会给我一个像数组数组这样的数据
但这不是...我从不尝试使用动态 URL...
这是tableview1中的代码,让我从 URL 获取 plist
NSURLRequest *theRequest=[NSURLRequest requestWithURL:appDelegate.URL1//I declare the URL at appDelegate.m for some reasons...
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:60.0];
NSData *returnData = [NSURLConnection sendSynchronousRequest:theRequest
returningResponse:nil error:nil];
NSString *listFile = [[NSString alloc] initWithData:returnData encoding:NSASCIIStringEncoding];
self.array = [listFile propertyList];//I parse the data from array to tablecview
这就是我将标题从Tableview1解析到Tableview2的方式
- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath {
TableView2 *tb2 = [[TableView2 alloc]init];
tb2.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
tb2.title = [[[array objectAtIndex:indexPath.row] valueForKey:@"name"]description];
[self.navigationController pushViewController:tb2 animated:YES]; }
有任何想法吗 ?
好吧......如果有人能回答这个问题或给我一个方向,我将非常感激
非常感谢所有的回复和回答!!!
哦...还有一件事,我可以使用ASIHTTPRequest发布数据
但我不知道如何在发布后获取数据......?(这有帮助吗?)