我在下面的目標是讓Popover通過兩條路徑之一出現。以編程方式調用Popover不起作用
第一個按鈕被按下,第二個按倒數計時器到時。
第一個工作 - 我有一個Storyboard Segue配置爲Popover並綁定到按鈕。按下按鈕時,彈出窗口出現。大!
第二個不是 - 我有一個計時器(NSTimer),它每秒調用一次方法,用倒計時中剩下的秒數更新一個標籤。當倒計時達到零時,我想自動調用彈出窗口。我試過兩種方法 - 一種是以編程方式調用按鈕([self popoverButton:self]
)。另一種是使用下面的代碼:
PopViewController *myPopVC = [[PopViewController alloc] init];
UIStoryboardSegue *aSegue = [[UIStoryboardSegue alloc] initWithIdentifier:@"popoverSegue" source:self destination:myPopVC];
[self prepareForSegue:aSegue sender:self];
[aSegue perform];
無論是這兩種方法的工作所以任何幫助,將不勝感激。
謝謝凱文。 'performSegueWithIdentifier'方法適用於我。 乾杯。 Tony。 – Tony