我想獲取存儲在我的數據庫中的表格視圖的值,我成功了,現在我的表格視圖有URL它的值,我想要的是當我點擊特定單元格的值時細胞去我的UIWebView
,它加載。表視圖將數據庫中的值傳遞給UIWebView?
爲此,我製作了一個導航控制器,每當選擇任何一行時,我都會推動它。
我粘貼我的代碼在這裏尋求幫助。
對於表視圖:
**- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [appdelegate.tablearr count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Simple"];
if (cell == nil) {
cell = [[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"Simple"]autorelease];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
NSDictionary *rowVals = (NSDictionary*) [appdelegate.tablearr objectAtIndex:indexPath.row];
scanValue = (NSString*) [rowVals objectForKey:@"descrip"];
cell.textLabel.text = scanValue;
// Set up the cell
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
DetailViewController *DVC = [[[DetailViewController alloc]initWithNibName:@"DetailViewController" bundle:nil] autorelease];
// DVC.characterNumber = indexPath.row;
NSLog(@"%@ PASSING VALUE",scanValue);
DVC.detailstr = scanValue;
[self.navigationController pushViewController:DVC animated:YES];
}**
在我DETAIL VIEW CONTROLLER
,我已經作出了NSString *detailstr
,在任何商店從scanValue到來。
**- (void)viewDidLoad
{
[super viewDidLoad];
SecondViewController *sec = [[SecondViewController alloc]initWithNibName:@"SecondViewController" bundle:nil] ;
NSLog(@"WHAT IS COMING HERE %@",detailstr);
NSString *urladdress = detailstr;
NSURL *url = [NSURL URLWithString:urladdress];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webView loadRequest:request];**
現在任何人都可以幫助我在代碼的東西,任何幫助,我們會真正幫助我。
請問你能解釋一下你面臨的問題......你沒有解釋你的問題。 – 2012-07-23 12:47:48
如何將表格單元格的值傳遞給UIWeb視圖,以便表格單元格單擊該表格單元格中的值應傳遞到UIWeb視圖中? – 2012-07-23 18:00:02
根據你的老代碼,總是有相同的值發送到下一個視圖,但現在它將按照選擇單元格。請使用我發送的最新密碼\ – 2012-07-24 06:35:22