2011-11-13 460 views
1

在我的objective-c程序中,我使用標籤欄爲這些應用程序分離了不同的功能。在標籤欄的第一視圖顯示第二視圖之間相同的表瀏覽內容,我想,當用戶點擊第一視圖的細胞時,它會變成第二視圖,並執行:如何從一個視圖執行其他視圖的動作

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 

,將參數「indexPath是。該用戶選擇的第一視圖indexPath

請幫助~~

回答

0

我應該這樣做:

//from firstviewcontroller; 
    (SecondViewController *)secondvc; 
    [secondvc [tableview didSelectRowAtIndexPath]]; 

但話又說回來,你將不得不提供該功能所需的數據。如果您只是拉動indexPath,請確保它與其他表中的indexPath相同。 我的意思是,它似乎你有兩個不同的表,你要執行從表格中的一個函數到表B和可能是相當混亂

+0

並且不要忘記在H文件中添加@property。 – Farini

+0

@property(nonatomic,retain)UIViewController(SecondViewController *)secondvc – Farini

1

你不應該叫

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 

自己。你應該爲tableView設置一個委託,並且這個方法將被自動調用。

相關問題