UIAlertController无法正常工作

时间:2015-11-26 09:46:07

标签: ios xcode swift

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
    // Initialize Alert View
    let alertController = UIAlertController(title: "No Internet connection", message: "Please Connect to Internet", preferredStyle: .Alert)

    let EXITAction = UIAlertAction(title: "EXIT", style: .Destructive) {(action) in
        //...
        exit(0)

    }
    alertController.addAction(EXITAction)

    self.presentViewController(alertController, animated: true) {
        // ...
    }


}

如果使用click然后退出,我试图将此用于onLoad。 但什么都没发生。请帮忙

(我在编程方面很新)

2 个答案:

答案 0 :(得分:6)

您必须移动代码才能将WAR_REPORT_MSG1 = " AND regexp_like(pe.answer_recived,'^[^0-9]*[?][^0-9]*$') ";呈现给UIAlertController方法。

如果您在viewDidAppear中放置修改用户界面的代码,则不会将其应用于视图,因为视图控制器仍在加载。

答案 1 :(得分:0)

只需声明如下函数即可,您可以在In [164]: df.loc[df['FAV_FRUIT']==True, 'FAV_FRUIT'] = df['fruit'] df[df['FAV_FRUIT']!=False].drop_duplicates() Out[164]: cust fruit FAV_FRUIT 0 A MANGO MANGO 6 B APPLE APPLE 方法中将其称为viewDidAppear()

alert("Message String")