2017-07-14 78 views
0

我有一个uiScroll视图(超级视图),包含其子视图中的另一个uiScrollview。缩放uiscrollview包含另一个uiscrollview

当至少有一个触点在子视图外时,超级视图的缩放手势正在工作 但是当2个触摸点位于子视图内时,超级视图的缩放不起作用。

感谢您的帮助。

+0

你只需要超景观缩放? –

+0

我有另一个动作,使子视图缩放,通常我绝对需要放大的超视图。 –

+0

然后,你必须继承你的scrollView并传递触摸事件,如果你想要的话,我可以提供一些代码 –

回答

0

你需要继承你的滚动视图,并允许通过触摸事件,你需要在你的内心滚动视图

.H

#import <UIKit/UIKit.h> 

@interface SwipeableScrollView : UIScrollView 

@end 

.M

#import "SwipeableScrollView.h" 

@implementation SwipeableScrollView 


-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event 
{ 
    [self.superview touchesBegan:touches withEvent:event]; 
} 

-(void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event 
{ 
    [self.superview touchesMoved:touches withEvent:event]; 
} 

-(void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event 
{ 
    [self.superview touchesEnded:touches withEvent:event]; 
} 
/* 
// Only override drawRect: if you perform custom drawing. 
// An empty implementation adversely affects performance during animation. 
- (void)drawRect:(CGRect)rect { 
    // Drawing code 
} 
*/ 

@end 

希望这会使用这个类帮助