2017-07-14 77 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 

希望這會使用這個類幫助