Swift: how to disable user interaction while touch action is being carried out?

后端 未结 8 2433
执念已碎
执念已碎 2021-02-12 03:27

I\'m working with sprite kit and if the user touches the screen, the actions within

override func touchesBegan(touches: NSSet, withEvent event: UIEvent) {
            


        
8条回答
  •  你的背包
    2021-02-12 04:24

    If you want to disable a Buttons user's interaction, just do this when the screen loads.

    self.btnname.isUserInteractionEnabled = false
    

    If you want to disable the user interaction as a view, it will be same just remove the button name and add the view's name.

    If for some reasons, you want to enable interaction, just change "false" to "true".

提交回复
热议问题