• <tfoot id='toaXj'></tfoot>

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

          <bdo id='toaXj'></bdo><ul id='toaXj'></ul>

        <legend id='toaXj'><style id='toaXj'><dir id='toaXj'><q id='toaXj'></q></dir></style></legend>

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

        我的自定义按钮在 iCarousel iOS 中没有得到点击?

        时间:2023-07-08
          • <legend id='ZE1ww'><style id='ZE1ww'><dir id='ZE1ww'><q id='ZE1ww'></q></dir></style></legend>
                <tbody id='ZE1ww'></tbody>
              <tfoot id='ZE1ww'></tfoot>

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

              • <i id='ZE1ww'><tr id='ZE1ww'><dt id='ZE1ww'><q id='ZE1ww'><span id='ZE1ww'><b id='ZE1ww'><form id='ZE1ww'><ins id='ZE1ww'></ins><ul id='ZE1ww'></ul><sub id='ZE1ww'></sub></form><legend id='ZE1ww'></legend><bdo id='ZE1ww'><pre id='ZE1ww'><center id='ZE1ww'></center></pre></bdo></b><th id='ZE1ww'></th></span></q></dt></tr></i><div id='ZE1ww'><tfoot id='ZE1ww'></tfoot><dl id='ZE1ww'><fieldset id='ZE1ww'></fieldset></dl></div>
                  <bdo id='ZE1ww'></bdo><ul id='ZE1ww'></ul>
                • 本文介绍了我的自定义按钮在 iCarousel iOS 中没有得到点击?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  在我的示例中,我正在使用 iCarousel 在其中尝试在单击时展开图像?我所做的,在图像展开后,我在 view 的右下角添加 backButton 以便我可以返回到原始视图.但是那个按钮没有得到点击事件.我哪里错了?

                  In my example I am using iCarousel in which I am trying to expand image on clicking on it? What I have done,after image expands I am adding backButton on right bottom corner of view so that I can return to the original view. But that button is not getting click event. Where am I going wrong?

                  这是我的代码.

                  - (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index reusingView:(UIView *)view{
                  UIButton *button = (UIButton *)view;
                  UIView *buttonBackView=[[UIView alloc]initWithFrame:CGRectMake(0, 0, 475, 300)];
                  [buttonBackView setBackgroundColor:[UIColor blackColor]];
                   button = [UIButton buttonWithType:UIButtonTypeCustom];
                  button.frame = CGRectMake(0.0f, 0.0f, 475,300);
                  
                   UIImage *image=[_rareCSNYArrayImageItems objectAtIndex:index];
                  [button setBackgroundImage:image forState:UIControlStateNormal];
                  
                  [button addTarget:self action:@selector(buttonTapped:) forControlEvents:UIControlEventTouchUpInside];
                  
                  [buttonBackView addSubview:button];
                   return buttonBackView;
                  
                  }
                  
                  
                      - (void)buttonTapped:(UIButton *)sender
                  {
                  UIButton *button=(UIButton*)sender;
                  [button setFrame:CGRectMake(0,0,675,400)];
                  [button.superview setFrame:CGRectMake(-100, -70, 675, 500)];
                  UIButton *buttonReduce=[[UIButton alloc] initWithFrame:CGRectMake(580, 405, 85, 85)];
                  [buttonReduce setBackgroundColor:[UIColor clearColor]];
                  [buttonReduce setBackgroundImage:[UIImage imageNamed:@"reducebuutton.png" ] forState:UIControlStateNormal];
                  [buttonReduce addTarget:self action:@selector(buttonReduceTapped: ) forControlEvents:UIControlEventTouchUpInside];
                  [button.superview addSubview:buttonReduce];
                  [self.view bringSubviewToFront:buttonReduce];
                  }
                  
                  - (void)buttonReduceTapped:(UIButton *)sender{
                  
                  UIButton *button=(UIButton*)sender;
                  NSLog(@"ButtonClicked");
                  [button.superview setFrame:CGRectMake(0, 0, 475, 300)];
                  [button removeFromSuperview];
                  }
                  

                  推荐答案

                  按钮可能超出了它的超级视图的范围.iOS 视图可以在其父视图边界之外绘制,但不会接收超出这些边界的触摸事件.

                  The button is probably outside the bounds of it's superview. iOS views can be drawn outside of their superview bounds, but won't receive touch events outside those bounds.

                  如果按钮在轮播内部,请尝试在 iCarousel 视图上启用 clipsToBounds 以测试理论.如果它在轮播项目视图中,请尝试在您的 iCarousel 项目视图上启用 clipsToBounds.

                  If the button is inside the carousel, try enabling clipsToBounds on the iCarousel view to test the theory. If it's inside a carousel item view, try enabling clipsToBounds on your iCarousel item views.

                  如果它在旋转木马内部,请将其移到外面,或者只是将旋转木马框架变大.但是,如果它在项目视图中,由于 iCarousel 内部的工作方式,您无法轻松地通过动画将单个轮播视图放大.

                  If it's inside the carousel, either move it outside, or just make the carousel frame bigger. But if it's inside an item view, you can't easily animate making individual carousel views bigger because of the way iCarousel works internally.

                  在这种情况下,为了解决这个问题,我建议在轮播前而不是在轮播内部绘制展开视图.为了使动画更容易,您可以像当前一样在轮播中对图像缩放进行动画处理,然后在动画结束时将视图移动到超级视图层次结构的前面,这样用户就不会看到切换.

                  In that case, to fix it, I suggest drawing your expanded view in front of the carousel rather than inside it. To make it easier to animate, you could animate the image zoom while inside the carousel as you are doing currently, but then move the view to the front of the superview hierarchy at the end of the animation, so the user doesn't see the switchover.

                  这篇关于我的自定义按钮在 iCarousel iOS 中没有得到点击?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何从同一个故事板访问 Objective-C 和 Swift 类? 下一篇:如何在 iOS 8 中通过外观代理设置 UIButton 字体?

                  相关文章

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

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

                      <tfoot id='rSyaH'></tfoot>
                        <bdo id='rSyaH'></bdo><ul id='rSyaH'></ul>