如何用DrawerLayout实现挤压的抽屉效果,求大神解

 我来答
cestboncola
2016-01-13 · TA获得超过1440个赞
知道小有建树答主
回答量:1836
采纳率:0%
帮助的人:477万
展开全部
用MMDrawerController添加下列代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14

[self.drawerController setGestureShouldRecognizeTouchBlock:^<a href="https://www.baidu.com/s?wd=BOOL&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YvrHTvrH6snHNbmv7WnWKh0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPH6YnHn4nHTvrHT1njRznW0d" target="_blank" class="baidu-highlight">BOOL</a>(MMDrawerController *drawerController, UIGestureRecognizer *gesture, UITouch *touch) {
<a href="https://www.baidu.com/s?wd=BOOL&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YvrHTvrH6snHNbmv7WnWKh0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPH6YnHn4nHTvrHT1njRznW0d" target="_blank" class="baidu-highlight">BOOL</a> shouldRecognizeTouch = <a href="https://www.baidu.com/s?wd=NO&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YvrHTvrH6snHNbmv7WnWKh0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPH6YnHn4nHTvrHT1njRznW0d" target="_blank" class="baidu-highlight">NO</a>;
if(drawerController.openSide == MMDrawerSide<a href="https://www.baidu.com/s?wd=No&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YvrHTvrH6snHNbmv7WnWKh0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPH6YnHn4nHTvrHT1njRznW0d" target="_blank" class="baidu-highlight">No</a>ne && [gesture isKindOfClass:[UIPanGestureRecognizer class]]){
UINavigationController *nav = (UINavigationController *)drawerController.centerViewController;
//判断哪个<a href="https://www.baidu.com/s?wd=%E6%8E%A7%E5%88%B6%E5%99%A8&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YvrHTvrH6snHNbmv7WnWKh0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPH6YnHn4nHTvrHT1njRznW0d" target="_blank" class="baidu-highlight">控制器</a>可以滑到抽屉
if([nav.topViewController isKindOfClass:[HomeViewController class]]){
shouldRecognizeTouch = YES;
}else{
//返回yes表示可以滑动到左右侧抽屉
shouldRecognizeTouch = <a href="https://www.baidu.com/s?wd=NO&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YvrHTvrH6snHNbmv7WnWKh0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPH6YnHn4nHTvrHT1njRznW0d" target="_blank" class="baidu-highlight">NO</a>;
}
}
return shouldRecognizeTouch;
}];
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式