我想达到一个相当简单的效果。滚动视图和其上方的静态按钮。到目前为止没有问题。不幸的是,如果我想“通过”按钮滚动视图,就会出现问题。所以开始在按钮内部拖动会影响按钮,而不是滚动视图。
关于如何实现这一目标的任何想法?
非常感谢!
我认为这种方法行不通,因为 touchesBegan 在 UIScrollView 中已被弃用……(此信息是真的吗?)
不是解决方案:-)
@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
不幸的是,这还不起作用。我认为下一个响应者是我的 UIView 而不是我的 UIScrollView。有任何想法吗?
如果我的视图控制器(即 nextResponder)将触摸传递给滚动视图,则也不会发生任何事情。