2011-04-06 69 views
2

我使用披露BTN在UITableViewcell.When我使用:點擊DetailDisclosureButton導航?

 
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 

它導航到anotherViewController那裏當我使用以下它不BTN點擊瀏覽

 
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;

我應該怎麼做的導航點擊DetailDisclosureButton?

回答

12

手柄這裏事件 -

- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath 
+0

+1。要從indexPath獲取單元格,您可能希望將基礎數據結構存儲爲一個數組,其中的行對應於數組的索引(例如,如果它是項目列表,則是MyListItem類或類似項)。然後,通過一個實例變量/屬性將'UITableViewCell'鏈接到你的'MyListItem',或者在'MyListItem'中存儲一個標誌,指示在選擇它時是否應該導航。如果你可以讀取單元格,請檢查if([(MyListItem *)[myItemArray objectAtIndex:indexPath.row] cell] .accessoryType = UITableViewCellAccessoryDisclosureIndicator)。 – darvids0n 2011-04-06 06:22:46