經過手勢UIGestureRecognizerDelegate 代理辦法處理
首先:內部的scrollview
UIScrollView *scrollView = [[UIScrollView alloc] init];
self.mainScrollView = scrollview;
[self.view addSubview:self.mainScrollView];
// 給主scrollview 添加手勢
UIGestureRecognizer *mainScrollVTap = [[UIGestureRecognizer alloc]init];
mainScrollVTap.delegate=self;
[self.mainScrollView addGestureRecognizer:mainScrollVTap];
其次: 給BMKMapView 添加手勢
BMKMapView *mapView = ({
CGFloat x = 0.0;
CGFloat y = self.view.bounds.origin.y;
CGFloat w = self.view.bounds.size.width;
CGFloat h = mainWidth;
BMKMapView *v = [[BMKMapView alloc] initWithFrame:CGRectMake(x, y, w, h)];
v.delegate = self;
v;
});
self.provinceMapView = mapView;
[self.mainScrollView addSubview:mapView];
UITapGestureRecognizer *provinceMapTap = [[UITapGestureRecognizer alloc] initWithtarget:self action:@selector(provinceMapTapped)];
provinceMapTap.delegate = self;
[self.provinceMapView addGestureRecognizer:provinceMapTap];
闡明:地圖的tap中的辦法必需完成
-(void)provinceMapTapped
{
}
再完成手勢的代理辦法:
#pragma mark 手勢代理辦法 ,判別觸摸的是地圖還是外層的view
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
//判別假如是百度地圖的view 既可以完成手勢拖動 scrollview 的滾動封閉
if ([gestureRecognizer.view isKindOfClass:[BMKMapView class]] ){
self.mainScrollView.scrollEnabled = NO;
return YES;
}else{
self.mainScrollView.scrollEnabled = YES;
return NO;
}
}
【關於iOS頁面中scrollview中嵌入百度地圖滑動抵觸問題處置步驟】的相關資料介紹到這裡,希望對您有所幫助! 提示:不會對讀者因本文所帶來的任何損失負責。如果您支持就請把本站添加至收藏夾哦!