2015-06-17 49 views
-2
-(IBAction)btn:(id)sender { 

    abcViewController *vc = [[abcViewController alloc]initWithNibName:@"abcViewController" bundle:nil]; 
    vc.str = @"hello"; 
    [self.navigationController pushViewController:vc animated:YES]; 
} 
+2

http://stackoverflow.com/questions/8429088/ios-storyboard-passing-data-navigationviewcontroller –

回答

0

退房此代碼

的UIViewController * VC = [故事板instantiateViewControllerWithIdentifier:@ 「identifierName」];
vc.label = @「Text」;
[self.navigationController pushViewController:vc animated:YES];

+0

感謝Rajesh Maurya ...... –

+0

它可以解決你的問題嗎?如果是,請將其接受並點擊上方的投票按鈕。謝謝。 – Rajesh

0

假設您想使用故事板將字符串值從一個視圖發送到另一個視圖。 在第一個視圖控制器中聲明.h文件中的變量,如NSString str;並在第二個視圖控制器聲明變量在.h像NSString newStr ;. 然後在.m文件的第一個視圖控制器中使用故事板創建第二個視圖對象 - SecondViewController * svc = [storyboard instantiateViewControllerWithIdentifier:@「SecondViewController」]; 並使用此對象將變量發送到第二個視圖- svc.newStr = str;

+0

無法正常工作....... –

相關問題