
@IBAction func addVote1(sender: AnyObject) { var query = PFquery(classname: "VoteCount") query.getobjectInBackgrounDWithID("BIEM17uUYT") { (VoteCount1: PFObject!,error: NSError!) ->VoID in if error != nil { NSLog("%@",error) } else { VoteCount1.incrementKey("Votes") VoteCount1.saveInBackgrounDWithTarget(nil,selector: nil) } let Votes = VoteCount1["Votes"] as Int let Votes2 = VoteCount1["Votes2"] as Int self.pollResults1.text = "\(Votes) Votes \(Votes2) Votes" } }@IBAction func addVote2(sender: AnyObject) { var query = PFquery(classname: "VoteCount") query.getobjectInBackgrounDWithID("BIEM17uUYT") { (VoteCount1: PFObject!,error: NSError!) -> VoID in if error != nil { NSLog("%@",error) } else { VoteCount1.incrementKey("Votes2") VoteCount1.saveInBackgrounDWithTarget(nil,selector: nil) } let Votes = VoteCount1["Votes"] as Int let Votes2 = VoteCount1["Votes2"] as Int self.pollResults2.text = "\(Votes) Votes \(Votes2) Votes" } }}解决方法 如果尚未设置按钮的@IBOutlet属性,则添加按钮的延迟var数组.在按钮处理程序中,将每个按钮的enabled属性设置为false. class VIEwController { @IBOutlet var button1: UIbutton! @IBOutlet var button2: UIbutton! lazy var buttons: [UIbutton] = [self.button1,self.button2] // ... @IBAction func addVote1(sender: AnyObject) { for button in self.buttons { button.enabled = false } // ... }} 总结 以上是内存溢出为你收集整理的ios – 如何在XCode中按下所有按钮时禁用所有按钮?全部内容,希望文章能够帮你解决ios – 如何在XCode中按下所有按钮时禁用所有按钮?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)