看板 MacDev 關於我們 聯絡資訊
懇請各位高手幫忙!! 小弟我在這個問題卡了兩天 問題就是,我使用TableView顯示我SQLite裡面的名稱 現在可以正常顯示出來了,但是點選cell之後卻不會切換頁面, - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // Navigation logic may go here. Create and push another view controller. edituserview *detailViewController = [[edituserview alloc] init]; detailViewController = indexPath.row; // ... // Pass the selected object to the new view controller. [self.navigationController pushViewController:detailViewController animated:YES]; [detailViewController release]; } 這是我切換頁面的一些語法, 因為用這個方法在其他Project是可以正常顯示, 但是帶入SQLite的資料之後就無法切換頁面,是因為帶入SQLite之後要用其他方式嗎? 這個問題卡很久了,希望各位幫幫忙!! -- ******************************************************************* 如果將字母 A 到 Z 分別編上 1 到 26 的分數,(A=1,B=2...,Z=26) 你的知識(KNOWLEDGE)得到 96 分(11+14+15+23+12+5+4+7+5=96) 你的努力(HARDWORK)也只得到 98 分(8+1+18+4+23+15+18+11=98) 你的態度(ATTITUDE)才是左右你生命的全部(1+20+20+9+20+21+4+5= <100> ) ******************************************************************* -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.32.26.126
Xezzaosui:你先搞懂 indexPath 在幹嘛就知道怎麼解了 04/12 13:36
johnlinvc:detailViewController = indexPath.row XDDD 04/12 14:29
iwayne:detailViewController = indexPath.row ~~ 那只是個數字@@" 04/12 16:44
抱歉,那個是我看書上寫的因為他也是帶資料進去只是他是使用case固定的 但是我是要把SQLite的資料帶進去 我剛剛看了書,查了些資料 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // Navigation logic may go here. Create and push another view controller. edituserview *detailViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"test"]; [self.navigationController pushViewController:detailViewController animated:YES]; [detailViewController release]; } 最後程式碼變這樣 但是還是無法換頁面 現在想說先把切換頁面做好在來考慮帶資料 但是連頁面都無法切換 ※ 編輯: love100205mt 來自: 114.32.26.126 (04/12 17:18)
tentenlee:都用storyboard 建立segue 指到那個segue 04/12 21:10
tentenlee:或是直接CELL拉SEGUE去下一頁 不用寫code就直接切換了 04/12 21:11
NelsonT:你的storyboard有把navigation controller 放進去嗎? 04/18 00:11