2011-09-03 55 views

回答

0

如果您知道詳細視圖出現的原因,我不清楚。所以我會解釋以防萬一。如果你正在控制一個細節視圖,那是因爲你的代碼中的某個地方正在推送這個細節視圖。這取決於你正在使用什麼樣的UITableViewCell。如果您使用的默認樣式之一,您的詳細視圖可能已在推之一:

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

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

如果您使用的是自定義單元格,那麼你就需要去尋找負責推動 那個詳細視圖的方法。

我認爲一個好的辦法是:

  1. 卸下推動無論它是。
  2. 如果您使用的是UITableViewCellAccessoryType,則不要使用UITableViewCellAccessoryType。
  3. 做類似的東西下面您tableView:didSelectRowAtIndexPath:

    • 查找在你的模型排列正確的答案行,根據挖掘細胞。
    • 使用該行號生成NSIndexPath
    • 使用NSIndexPathcellForRowAtIndexPath:
    • 呼叫setSelected:animated:在該小區找到正確的單元格以突出顯示它。

注意:如果您的測驗比的UITableViewCells適合在屏幕上,你應該滾動鼠標UITableView到正確的答案更好的UX量更多的答案。

+0

再次檢查.. –

+0

問題是,當進行選擇時,不會調用cellForRowAtIndexPath。 –

+0

,因爲這不是委託調用的方法,它調用'tableView:didSelectRowAtIndexPath:'。 – rjgonzo

相關問題