1 回答

TA貢獻2041條經(jīng)驗 獲得超4個贊
不明白
從兩個 ViewController 到一個
我將展示如何將數(shù)據(jù)從ControllerA傳輸?shù)紺ontrollerB。
控制器A:
public override void PrepareForSegue(UIStoryboardSegue segue, NSObject sender)
{
base.PrepareForSegue(segue, sender);
var controllerB = segue.DestinationViewController as ControllerB ;
controllerB.passValue = "ControllerA's data";//set data from ControllerA
controllerB.retSegue = segue;
}
控制器B:
public string passValue;
public override void ViewDidLoad()
{
base.ViewDidLoad();
//labeltwo is a Label Control in ControllerB
labeltwo.Text = passValue ; // here can get data from ControllerA
}
如果您想要從ControllerA導航到ControllerB,最后導航到ControllerC,也可以使用up方式傳輸數(shù)據(jù)。
- 1 回答
- 0 關(guān)注
- 155 瀏覽