[英]popViewController does not go back
我正在制作一个从解析中检索图像并将其显示到集合视图的应用程序。 当用户点击图像时,图像将详细显示。 我有一个用户可以更改的文本字段。 当用户更改某些内容时,他们会单击“保存”按钮并返回到集合视图。 回到集合视图控制器的代码不起作用。
@IBAction func saveButton(sender: AnyObject) {
// Use the sent country object or create a new country PFObject
if let saveInBackWithBlock = currentObject as PFObject? {
updateObject = currentObject! as PFObject
} else {
updateObject = PFObject(className:"Tops")
}
// Update the object
if let updateObject = updateObject {
updateObject["imageText"] = topsLabel.text
// Create a string of text that is used by search capabilites
var searchText = (topsLabel.text)
updateObject["searchText"] = searchText
// Update the record ACL such that the new record is only visible to the current user
updateObject.ACL = PFACL(user: PFUser.currentUser()!)
// Save the data back to the server in a background task
updateObject.saveInBackgroundWithBlock{
(success: Bool, error: NSError?) -> Void in
if (success) {
// The object has been saved.
} else {
// There was a problem, check error.description
}
}
print("saved")
}
self.navigationController?.popViewControllerAnimated(true)
}
我不知道为什么它不返回到以前的视图控制器。谢谢
您的父视图是否嵌入在导航控制器中? 还-如何呈现视图?
在您刚刚添加的帖子中-您无法弹出模式VC-而是尝试关闭视图控制器。
检查它是否嵌入在Navigation Controller中,请尝试:
希望能帮助到你。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.