我在viewDidLoad方法創建的按鈕:連接SEGUE,使用編程創建的按鈕
UIButton * button2 = [UIButton buttonWithType:UIButtonTypeCustom];
[button2 addTarget:self action:@selector(showVideo:)forControlEvents:UIControlEventTouchUpInside];
在按鈕操作方法我稱爲SEGUE編程:
- (void) showVideo:(id)sender {
[self performSegueWithIdentifier: @"MySegue" sender: self];
}
在用於SEGUE準備方法調用模態視圖控制器的代碼
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString:@"MySegue"])
{
Xen_VideoViewController *addController = [segue destinationViewController];
[self presentViewController:addController animated:YES completion: nil];
}
}
我提到了lin K [鏈接]:Creating a segue programmatically
但我正的誤差作爲
「應用程序試圖模態呈現活動控制器」
我需要示出了當按鈕按下模態視圖控制器,但該按鈕以編程方式創建。該按鈕在滾動視圖中重複。
任何其他獲取模態視圖控制器的方法?
在此先感謝...。
感謝Husein,它爲我工作......。 再次感謝您爲我節省時間......。 – Bala
歡迎你@Bala :) –
如何通過模態視圖控制器的數據而不使用準備segue方法是否有其他方法... – Bala