Iphone 将事件从UIScrollView转发到UIButton
我在Iphone 将事件从UIScrollView转发到UIButton,iphone,ios,uiscrollview,uibutton,touch,Iphone,Ios,Uiscrollview,Uibutton,Touch,我在UIScrollView中找到了一个UIButton。问题在于ui按钮不够大,无法填充整个UIScrollView。我希望能够将UIScrollView其他区域中的触摸事件转发到UIButton。以下是我的应用程序的屏幕截图: 有人知道怎么做吗?我不确定你是否可以用这种方式转发触摸,但我想你可以调整UIButton的大小以填充整个scrollView,并使内容不拉伸,使其看起来完全相同,但会有一个更大的UIButton [button addTarget:self action:@sele
UIScrollView
中找到了一个UIButton
。问题在于ui按钮
不够大,无法填充整个UIScrollView
。我希望能够将UIScrollView
其他区域中的触摸事件转发到UIButton
。以下是我的应用程序的屏幕截图:
有人知道怎么做吗?我不确定你是否可以用这种方式转发触摸,但我想你可以调整UIButton的大小以填充整个scrollView,并使内容不拉伸,使其看起来完全相同,但会有一个更大的UIButton
[button addTarget:self action:@selector(itemTouched:)forControlEvents:UIControlEventTouchUpInside];
- (void) itemTouched:(UIButton*) sender
{
[self performSelectorOnMainThread:@selector(doSomething:) withObject:sender waitUntilDone:NO];
}
在调用
doSomething
方法之前,可以显示ui按钮的突出显示。要将链接传播到子视图,请使用:
[mychild touchesBegan:touches withEvent:event];
在scrollView的触摸屏中开始。iOS(iPhone、iPod touch和iPad)