我希望在表格的每个单元格中使用标签创建链接。
当用户点击链接时,将获取该单元格的[indexpath row],并使用该索引匹配包含字符串数据的数组索引。然后将该字符串发送到下一个推送页面。
我使用UITapGestureRecognizer轻敲标签,并将参数传递给选择器方法。
如何获取所选单元格上的标签的当前indexpath row?
以下是我的示例代码:
当用户点击链接时,将获取该单元格的[indexpath row],并使用该索引匹配包含字符串数据的数组索引。然后将该字符串发送到下一个推送页面。
我使用UITapGestureRecognizer轻敲标签,并将参数传递给选择器方法。
如何获取所选单元格上的标签的当前indexpath row?
以下是我的示例代码:
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
...
UITapGestureRecognizer *gestureRec = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(openUrl:) ];
gestureRec.numberOfTouchesRequired = 1;
gestureRec.numberOfTapsRequired = 1;
[cell.listPrice addGestureRecognizer:gestureRec];
[gestureRec release];
...
}
- (void)openUrl:(id)sender
{
NSLog(@"DOwnload URL send >> %@",urlDownloadSend);
DownloadNowController *download =[[DownloadNowController alloc]initWithNibName:@"DownloadNowController" bundle:nil];
[self.navigationController pushViewController:download animated:YES];
[download release];
}