AView.m
UIButton *btn = [[UIButton alloc]initWithFrame()];
[btn addTarget:self action:@selectior(perpareForSegue:sender:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:btn];
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
//I want to get destinationViewController of segue with identifier"toNextView"
// and then perform the segue
// Difficulties that I encounter is that I have a NSInvalidArgumentException
// Is that mean the view controller doesn't know the existence of the segue?
// I have connected two controller with a segue
}
我想用標識符「toNextView」賽格瑞的 destinationViewController,然後執行SEGUE 困難,我遇到的是,我有一個NSInvalidArgumentException 是指視圖控制器不知道SEGUE的存在? 我已連接兩個控制器與一個segue 謝謝如何以編程方式指定segue(不執行segue)?
謝謝,但我可以在將數據傳遞給destiniation視圖控制器時執行SegueWithIdentifier嗎? – user2429523
@ user2429523這就是prepareForSegue方法的用法。我更新了我的答案。 –
非常好...它可以解決,另外問題:如何將點擊按鈕的標籤發送到目標視圖控制器? – user2429523