gpt4 book ai didi

ios - 成功后切换回启动窗口

转载 作者:行者123 更新时间:2023-11-30 11:38:28 28 4
gpt4 key购买 nike

我还是初学者。我该怎么办,谁的图片和文字已经成功上传到TableView了?

 @IBAction func postImage(_ sender: Any) {

if let image = imageTopost.image {


let post = PFObject(className: "Post")

post["message"] = comment.text

post["userId"] = PFUser.current()?.objectId

if let imageData = UIImagePNGRepresentation(image){


let activityIndicator = UIActivityIndicatorView(frame: CGRect(x:0, y: 0, width: 50, height: 50))
activityIndicator.center = self.view.center
activityIndicator.hidesWhenStopped = true
activityIndicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyle.gray
view.addSubview(activityIndicator)
activityIndicator.startAnimating()
UIApplication.shared.beginIgnoringInteractionEvents()


let imageFile = PFFile(name: "image.png", data: imageData)
post["imageFile"] = imageFile
post.saveInBackground(block: { (success, error) in


activityIndicator.stopAnimating()
UIApplication.shared.endIgnoringInteractionEvents()


if success {
self.displayAlert(title: "Hat super geklappt", message: "Dein Ziel wurde erfolgreich hinzugefügt")
self.comment.text = ""
self.imageTopost.image = nil

}else {

self.displayAlert(title: "Etwas ist schiefgelaufen" , message: "Dein Bild konnte leider nicht gespeichert werden. Versuche es nochmal. Dein Internet muss eingeschalten sein." )
}
})
}
}
}

我想我这里就是代码。但不幸的是我不知道如何做到这一点

              if success {
self.displayAlert(title: "Hat super geklappt", message: "Dein Ziel wurde erfolgreich hinzugefügt")
self.comment.text = ""
self.imageTopost.image = nil

}else {

self.displayAlert(title: "Etwas ist schiefgelaufen" , message: "Dein Bild konnte leider nicht gespeichert werden. Versuche es nochmal. Dein Internet muss eingeschalten sein." )
}
})
}

最佳答案

您可以尝试更改根 VC

let homeView = self.storyboard?.instantiateViewController(withIdentifier: "homeView")
let nav = UINavigationController(rootViewController: homeView!)
nav.navigationBar.isHidden = true
UIApplication.shared.keyWindow?.rootViewController = nav

关于ios - 成功后切换回启动窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49475851/

28 4 0