UIButton在UIScrollView的不可见区域 [英] UIButton in non-visible area of UIScrollView

查看:171
本文介绍了UIButton在UIScrollView的不可见区域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何点击位于UIScrollView中的按钮,但是在最初的不可见区域?

How can I get a button tap for a button which is located in a UIScrollView, but in its initially non-visible area?

已解决

Solved
Problem was that the content was visible within a non-clipped view - therefore not getting touches.

推荐答案

我认为你应该在UIButton中添加一个动作(下面的代码中的yourAction)。

I think you should add an action (yourAction in the code below) to the UIButton.

以编程方式:

[button addTarget:self action:@selector(yourAction:) forControlEvents:UIControlEventTouchUpInside];


-(void)yourAction:(id)sender{
    // your code
}

使用gui构建器,您应该将您的UIButton连接到.h控制器文件中定义为IBAction的操作:

With the gui builder you should connect your UIButton to an action defined as IBAction in your .h controller file:

-(IBAction)yourAction:(id)sender;

这篇关于UIButton在UIScrollView的不可见区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆