Enabling a button using data from Parse.com - Swift

不羁的心 提交于 2019-12-25 04:50:11

问题


I am trying to enable a bar button if the user is labeled "Yes" in the SubscribedUser key. I really do not know how to do this. I have used queries before but only to call objects onto the screen, nothing like this before.

Here is what I have right now, I know it is wrong but I hope you get the idea of what I'm trying to do right now:

func enableButton() {

    var query: PFQuery = PFQuery(className: "User")

    query.whereKey("username", equalTo: PFUser.currentUser().username)


    if query.valueForKey("SubscribedUser") = "Yes"{

        self.barButton.enabled = true

    }else{

        self.barButton.enabled = false
    }



}

来源:https://stackoverflow.com/questions/28949865/enabling-a-button-using-data-from-parse-com-swift

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!