2013-07-10 13 views
1

這應該相當簡單,但由於某種原因,我無法解決這個問題。將字符串值傳遞給故事板中的下一個視圖控制器

我設置內在字符串存儲數據viewcontrollerA

NSString *TestA = nameTextField.text; 
NSLog(@"Output1 %@", TestA); 

viewcontrollerB我已經設置

@property (nonatomic, strong) NSString *TestA; 

我知道應當使用下面的方法來傳遞字符串accros的故事板,但我無法弄清楚。

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender 

對不起,有一個簡單的問題。

+0

@MicRO我做了,但無法得到工作的例子:( – memyselfandmyiphone

回答

1

試試這個:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender 
{ 
    viewcontrollerB *secView = [segue destinationViewController] 
    secView. TestA = nameTextField.text; 

} 

,並請做一些研究Cocoa Code Naming Basics,會有所幫助。

相關問題