2014-04-26 26 views

回答

0

假設你正在使用一個UITableView,而不是一個UIScrollView你只需要實現包含的UITableView

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
//Use indexPath to determine which of the 10 rows was actually selected 
switch(indexPath.row){ 
case 0: 
//Create and fire off a DetailViewController for row 0 
break; 
case 1: 
//Create and fire off a DetailViewController for row 1 
break; 
} 
} 

除了在這裏的類以下委託調用是一個教程解釋的UITableView行選擇:UITableView Tutorial
也是官方Apple Doc:Official Documentation

+0

對不起,我現在解決了這個問題,這是一個UITableView。感謝您的快速回答,我現在試試吧 – user3466512

+0

它給出了一個錯誤,說它期望一個int而不是索引路徑。我能做些什麼呢? – user3466512

+0

使用indexPath.row,也編輯上面的答案來反映這 – davito93

相關問題