2017-04-05 62 views
-2

我想要的是當你點擊表格中的任何單元格時,你會轉到另一個表格視圖。我還需要爲每個不同的單元格單擊您獲取的視圖具有不同的字符串。但我不知道Objective-C連接兩個Tableviews

1)如何在ViewController中將表格單元與另一個tableview鏈接,當你按下它時 2)如何在View控制器中更改每個表格視圖(包括文本和音頻文件)點擊不同的單元格。

+0

您應該瞭解所有的TableView https://developer.apple.com/reference/uikit/uitableview –

+0

的委託方法你問題是不恰當的..之前得到的投票下來更正您的問題.. –

回答

1

對於tableview中使用委託方法檢測的任何行點擊

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ 
} 
0
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
[tableView deselectRowAtIndexPath:indexPath animated:YES]; 

NSLog(@"index path cell row number =======%ld",(long)indexPath.row);//you can get the index number of that cell 

NSLog(@"data of clicked cell====%@",[yourArray objectAtIndex:indexPath.row]);//here you can get the data of that cell 

}