Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/119.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios Swift 4.0中未通过Segue调用函数_Ios_Swift_Function - Fatal编程技术网

Ios Swift 4.0中未通过Segue调用函数

Ios Swift 4.0中未通过Segue调用函数,ios,swift,function,Ios,Swift,Function,我已经开始学习Swift 4和iOS应用程序开发 我已经建立了一个基本的应用程序,允许用户注册并将自己添加到用户表中,或者登录并显示已经注册的用户。我在我的主情节提要中创建了一个条形按钮项(注销),并用一个segue将该按钮连接到主用户屏幕。我还创建了一个用户表视图控制器,该控制器具有注销用户的功能。以下是if代码、主故事板以及segue和button定义的图像 问题是,当我按下应用程序中的注销按钮时,实际的注销功能从未被调用。我相信它是有效的,因为它会在主用户注册屏幕上闪烁一秒钟(根据segu

我已经开始学习Swift 4和iOS应用程序开发

我已经建立了一个基本的应用程序,允许用户注册并将自己添加到用户表中,或者登录并显示已经注册的用户。我在我的主情节提要中创建了一个条形按钮项(注销),并用一个segue将该按钮连接到主用户屏幕。我还创建了一个用户表视图控制器,该控制器具有注销用户的功能。以下是if代码、主故事板以及segue和button定义的图像

问题是,当我按下应用程序中的注销按钮时,实际的注销功能从未被调用。我相信它是有效的,因为它会在主用户注册屏幕上闪烁一秒钟(根据segue),但该代码永远不会执行。它只是返回到主用户表视图。我在代码中添加了print语句(用于控制台)和断点,但它从来没有做到这一点。下面是代码。它位于UserTableViewController.swift文件中

导入UIKit 导入解析

类UserTableViewController:UITableViewController{

//function to control what happens when the user presses the logout button


@IBAction func logoutUser(_ sender: Any) {

    // log the user out; make sure you import Parse into the view controller so you can access the PFUser functions
    print ("getting ready to logout user")

    PFUser.logOut()

    print ("logged out user from parse")

    // perform the segue to the main login screen; don't need self. before the performSegue because we want the action to happen in the main view controller

    performSegue(withIdentifier: "logoutSegue", sender: self)

    print("You should see the main screen now")

}
提前感谢您的帮助。很抱歉之前添加了图片


Mike

您的主脚本图标是灰色的,因为您需要保存该文件。

您需要通过按Command+S来保存灰色文件,然后在您所做的更改反映到最新运行的应用程序中。

主脚本图标是灰色的,因为有东西要保存。您可以弹出view c,而不是执行segue操作OnController.self.navigationController.popViewController(动画:true)。它将返回到上一屏幕。请不要发布代码图像。编辑您的问题以包含代码。