dan*_*ser 3 iphone uibutton uiscrollview touches
我想要达到一个相当简单的效果.一个scrollView和它上面的静态按钮.到目前为止还没问题.不幸的是,如果我想滚动视图"低谷"按钮,就会出现问题.因此,开始在按钮内拖动将影响按钮,而不是滚动视图.
关于如何实现这一点的任何想法?
非常感谢!
我认为这种方法不起作用,因为在UIScrollView中不推荐使用touchesBegan ...(这个信息是真的吗?)
不是解决方案:-)
@implementation MySuperButton
+ (id)buttonWithFrame:(CGRect)frame {
return [[[self alloc] initWithFrame:frame] autorelease];
}
- (id)initWithFrame:(CGRect)frame {
if (self == [super initWithFrame:frame]) {
NSLog(@"initWithFrame");
}
return self;
}
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[super touchesBegan:touches withEvent:event];
[self.nextResponder touchesBegan:touches withEvent:event];
NSLog(@"[self nextResponder]: %@", [self nextResponder]);
}
@end
Run Code Online (Sandbox Code Playgroud)
不幸的是,这不起作用.我认为下一个响应者是我的UIView而不是我的UIScrollView.有任何想法吗?
如果我的viewcontroller是nextResponder,将触摸传递给scrollView,那么也没有任何反应.
Eik*_*iko 12
将按钮添加到滚动视图但不添加到其父视图,一切都应该正常工作.直接触摸按钮将传递到按钮,背景上的触摸(滚动视图)将传递到滚动视图.
由于按钮不是滚动视图的子视图,因此它不会随背景一起移动(我认为你的意思是静态).
| 归档时间: |
|
| 查看次数: |
2040 次 |
| 最近记录: |