菜鸟教程小白 发表于 2022-12-12 13:25:56

ios - 如何在同一时间点禁用屏幕上的多个用户交互


                                            <p><p>在我的应用程序中包含 no.of UIElements,例如 <code>facebook 按钮、twitter 按钮、注销按钮、带有手势的 imageview</code>。</p>

<p>`</p>

<pre><code>facebookBtn = ;
;
;
;
;`

`twitterBtn = ;
;
;
;
;`


`imageTapGesture =[ initWithTarget:self action:@selector(sectionTapping:)];
;`

`sectionPortraitImageView = [ initWithFrame:CGRectMake(0, 0, 100, 100)];
;
;
;`
</code></pre>

<p>像这样我添加了所有元素
当用户一次单击所有按钮时,所有三个功能都在工作。
这里只需要进行一项操作。</p>

<p>我该如何解决这个问题?</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>一次处理多个触摸问题并设置单个属性</p>

<p><code>;
</code>
//处理所有 subview 的多点触摸用户交互 </p>

<pre><code> -(void)multipleTouchHandling
{
    self.view.multipleTouchEnabled=NO;
    self.view.exclusiveTouch=YES;
    for(UIView* view1 in self.view.subviews)
    {
      if(])
      {
            UIButton* btnVw = (UIButton*)view1;
            ;
      }
    }
}
</code></pre></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 如何在同一时间点禁用屏幕上的多个用户交互,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/27653214/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/27653214/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 如何在同一时间点禁用屏幕上的多个用户交互