Preventing multiple buttons from being touched at the same time

前端 未结 6 1553
猫巷女王i
猫巷女王i 2021-02-01 02:24

In iOS is there anyway to prevent a UIView containing multiple buttons (siblings) from being simultaneously from being touched? For instance, two non-overlapping buttons that ar

6条回答
  •  轮回少年
    2021-02-01 02:34

    I have tried both  multiTouchEnabled and exclusiveTouch but unfortunately 
    none of them workout for me.I have tried the following code worked 
    perfectly.
    

    Set this code at .h file

    BOOL ClickedBool;
    

    Set the following code at method start.

    if(ClickedBool==TRUE)
    {
         return;
    }
    else
    {
        ClickedBool=TRUE;
    }
    

提交回复
热议问题