<legend id='1upfj'><style id='1upfj'><dir id='1upfj'><q id='1upfj'></q></dir></style></legend>
      <i id='1upfj'><tr id='1upfj'><dt id='1upfj'><q id='1upfj'><span id='1upfj'><b id='1upfj'><form id='1upfj'><ins id='1upfj'></ins><ul id='1upfj'></ul><sub id='1upfj'></sub></form><legend id='1upfj'></legend><bdo id='1upfj'><pre id='1upfj'><center id='1upfj'></center></pre></bdo></b><th id='1upfj'></th></span></q></dt></tr></i><div id='1upfj'><tfoot id='1upfj'></tfoot><dl id='1upfj'><fieldset id='1upfj'></fieldset></dl></div>
      <tfoot id='1upfj'></tfoot>
    1. <small id='1upfj'></small><noframes id='1upfj'>

      • <bdo id='1upfj'></bdo><ul id='1upfj'></ul>

      你如何知道在 touchesBegan 中被触摸的对象是什么?

      时间:2024-04-14
        <tbody id='Koz6c'></tbody>

            <i id='Koz6c'><tr id='Koz6c'><dt id='Koz6c'><q id='Koz6c'><span id='Koz6c'><b id='Koz6c'><form id='Koz6c'><ins id='Koz6c'></ins><ul id='Koz6c'></ul><sub id='Koz6c'></sub></form><legend id='Koz6c'></legend><bdo id='Koz6c'><pre id='Koz6c'><center id='Koz6c'></center></pre></bdo></b><th id='Koz6c'></th></span></q></dt></tr></i><div id='Koz6c'><tfoot id='Koz6c'></tfoot><dl id='Koz6c'><fieldset id='Koz6c'></fieldset></dl></div>
          • <tfoot id='Koz6c'></tfoot>

            <small id='Koz6c'></small><noframes id='Koz6c'>

              • <bdo id='Koz6c'></bdo><ul id='Koz6c'></ul>
                <legend id='Koz6c'><style id='Koz6c'><dir id='Koz6c'><q id='Koz6c'></q></dir></style></legend>
                本文介绍了你如何知道在 touchesBegan 中被触摸的对象是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我知道这是一个非常常见的问题,但是每个网站上的所有答案都不起作用!如果你还是不明白我的意思,那么也许这行代码可以帮助你理解.

                I know that this is a very commonly asked question, but all of the answers on every website don't work! If you still don't know what I mean, then maybe this line of code will help you understand.

                
                - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
                    UITouch *touch = [[event allTouches] anyObject];
                    CGPoint location = [touch locationInView:self.view];
                    if (touch.view == nextbutton)
                        [self performSelector:@selector(next)];
                    if (touch.view == prevbutton)
                        [self performSelector:@selector(previous)];
                    if (touch.view == moreoptionsbutton)
                        [self performSelector:@selector(moresettings)];
                }
                

                当你触摸 nextbutton、prevbutton 和 more optionsbutton 时,它不会做任何事情,顺便说一下,它们是 UIImageViews.我也尝试过使用 isEqual: 而不是 ==,但这也没有成功.有什么建议吗?

                It doesn't do anything when you touch nextbutton, prevbutton, and more optionsbutton, which are UIImageViews by the way. I have also tried using isEqual: instead of ==, but that hasn't worked out either. Any suggestions?

                推荐答案

                你必须为你所有的 UIImageViews 设置 userinteractionEnabled = YES 否则他们将不会收到触摸事件.同时换行:

                You have to set userinteractionEnabled = YES for all your UIImageViews otherwise they will not receive touch events. Also change the line:

                 UITouch *touch = [[event allTouches] anyObject];
                

                 UITouch *touch = [touches anyObject];
                

                这篇关于你如何知道在 touchesBegan 中被触摸的对象是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:无法转换类型 '() -&gt; 的值_' 指定类型 UIImageView 下一篇:将 TintColor 设置为 MKAnnotationView 图像

                相关文章

                  <i id='5nbxR'><tr id='5nbxR'><dt id='5nbxR'><q id='5nbxR'><span id='5nbxR'><b id='5nbxR'><form id='5nbxR'><ins id='5nbxR'></ins><ul id='5nbxR'></ul><sub id='5nbxR'></sub></form><legend id='5nbxR'></legend><bdo id='5nbxR'><pre id='5nbxR'><center id='5nbxR'></center></pre></bdo></b><th id='5nbxR'></th></span></q></dt></tr></i><div id='5nbxR'><tfoot id='5nbxR'></tfoot><dl id='5nbxR'><fieldset id='5nbxR'></fieldset></dl></div>
                  • <bdo id='5nbxR'></bdo><ul id='5nbxR'></ul>
                1. <tfoot id='5nbxR'></tfoot>

                    <legend id='5nbxR'><style id='5nbxR'><dir id='5nbxR'><q id='5nbxR'></q></dir></style></legend>
                  1. <small id='5nbxR'></small><noframes id='5nbxR'>