[問題] tabBarView delegate 傳值
如果現在有一個 tabBarViewController
內含了 View A 和 View B
我想在 使用者點選 View B , View A viewDidDisappear 時將值傳給View B
我用StoryBoard , 並在ViewB的StoryBoardID 設定為 ViewB,
之後我先宣告了一個 protocol
在 B.m中進行實作
- (void)passValueMethod:(NSString *)string
{
self.Label.text = string;
}
在A.h 中 property(assign, nonatomic) id<passValue> delegate;
在A.m 中
ViewDidDisappear 時
ViewB *B = [self.storyboard instantiateViewControllerWithIdentifier:@"ViewB"];
A.delegate = B;
[A.delegate passValueMethod:@"John"];
可是並沒有正確取得 ViewB 的指針, 所以Label也沒有改變
請問該怎麼做才是正確的呢?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 60.251.44.30
推
10/28 21:51, , 1F
10/28 21:51, 1F
→
10/28 21:53, , 2F
10/28 21:53, 2F
→
10/28 21:53, , 3F
10/28 21:53, 3F
MacDev 近期熱門文章
PTT數位生活區 即時熱門文章