簡體   English   中英

預成型后編輯導航欄

[英]Edit Nav Bar after preformSegue

如何在導航欄上刪除“后退”按鈕

self.performSegueWithIdentifier("Segue", sender: nil)

好,讓我解釋一下。 我在導航欄中嵌入了一個配置文件頁面,您可以在編輯頁面中對其進行編輯,完成后,它會更新Parse上的信息,segue會將您帶回到配置文件頁面。 但是,用戶仍然可以單擊返回並重新加載編輯頁面,然后再次返回到原​​始配置文件頁面。

如何防止自動填充?

@IBAction func doneEditing(sender: AnyObject) {
    self.completeEdit()
}


func completeEdit() {
    var user = PFUser.currentUser()!
    user["Location"] = locationTextField.text

    user.saveInBackgroundWithBlock {
        (succeeded: Bool, error: NSError?) -> Void in
        if let error = error {
            let errorString = error.userInfo?["error"] as? NSString
            println("failed")
        } else {
            self.performSegueWithIdentifier("Edited", sender: nil)

        }
    }
}

新編輯^

這是我會嘗試使用您的代碼的方法:

@IBAction func doneEditing(sender: UIButton) {
self.completeEdit()

}

func completeEdit() {
    var user = PFUser.currentUser()!
    user["Location"] = locationTextField.text

user.saveInBackgroundWithBlock {
    (succeeded: Bool, error: NSError?) -> Void in
    if let error = error {
        let errorString = error.userInfo?["error"] as? NSString
        println("failed")
    } else {
        navigationController.popViewControllerAnimated(true)

    }
}

}

我所做的只是將“ AnyObject”更改為“ UIButton”,然后將“ perform segue”替換為“ popViewControllerAnimated”

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM