Re: [問題] Master-Detail的table移動highlight

看板MacDev作者 (Bang!)時間11年前 (2013/02/02 01:42), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/2 (看更多)
看來你已經解決問題了 不過建議一下用delegate 不要直接呼叫MasterViewController 理論上Detail不需要也不應該知道Master的實作細節 這樣之後要reuse Detail也比較方便 @property (weak, nonatomic) id <DetailViewControllerDelegate> delegate; @protocol DetailViewControllerDelegate <NSObject> - (void)detailViewController:(DetailViewController*)controller didSelectRowAtIndexPath:(NSIndexPath*)indexPath; @end : 我在 "DetailViewController.m" 追加 : #import "MasterViewController.h" : int select; ///設全域變數 : - (IBAction)downBtn:(id)sender { : select=select+1; : NSLog(@"down-select=%d",select); ///check 數值 : NSIndexPath *indexPathBlue; : indexPathBlue = [NSIndexPath indexPathForRow:select inSection:0]; : [self.masterViewController.tableView selectRowAtIndexPath:indexPathBlue animated:YES scrollPosition:UITableViewScrollPositionMiddle]; : } : 想說為啥光棒會消失~~(卡超久 : 原來-1忘了改+1 -_-||a -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 199.2.242.199
文章代碼(AID): #1H2_wIaN (MacDev)
文章代碼(AID): #1H2_wIaN (MacDev)