MyLinearLayout icon indicating copy to clipboard operation
MyLinearLayout copied to clipboard

Grid添加在ScrollView上模板上的点击事件无法响应

Open ZCFade opened this issue 5 years ago • 4 comments

` UIScrollView *scrollView = [UIScrollView new]; scrollView.backgroundColor = UIColor.whiteColor; scrollView.frame = CGRectMake(0, 0, kwidth, kheight); scrollView.userInteractionEnabled = YES; [self.view addSubview:scrollView]; self.view = scrollView;

MyGridLayout *rootLayout = [MyGridLayout new];
rootLayout.backgroundColor = [UIColor whiteColor];
rootLayout.myHorzMargin = 0;
rootLayout.myHeight = MyLayoutSize.wrap;
rootLayout.padding = UIEdgeInsetsMake(10, 20, 10, 20);
rootLayout.subviewSpace = 0;  //直接子栅格之间的间隔。
[scrollView addSubview:rootLayout];

self.rootLayout = rootLayout;

///模板
id<MyGrid> gridTemplate = [MyGridLayout createTemplateGrid:sTextStyleTag];
gridTemplate.gravity = MyGravity_Vert_Center;
gridTemplate.subviewSpace = 0;
[gridTemplate addRow:MyLayoutSize.fill];
[gridTemplate setTarget:self action:@selector(handleTap:)];`

ZCFade avatar Sep 27 '20 08:09 ZCFade

同问,兄弟,怎么解决的

zhangle520 avatar Jan 07 '21 08:01 zhangle520

点击事件添加在模板上 然后试图克隆模板

------------------ 原始邮件 ------------------ 发件人: "youngsoft/MyLinearLayout" <[email protected]>; 发送时间: 2021年1月7日(星期四) 下午4:23 收件人: "youngsoft/MyLinearLayout"<[email protected]>; 抄送: "朱冲"<[email protected]>;"Author"<[email protected]>; 主题: Re: [youngsoft/MyLinearLayout] Grid添加在ScrollView上模板上的点击事件无法响应 (#130)

同问,兄弟,怎么解决的

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

ZCFade avatar Jan 07 '21 08:01 ZCFade

非常感谢,后面通过下载官方demo发现并解决了问题,这里记录一下: 以你上面的例子为参考,MyGridLayout不能直接添加在UIScrollView上,需要在UIScrollView上添加一个mylinearlayout,然后把MyGridLayout添加到mylinearlayout中就可以了

zhangle520 avatar Jan 09 '21 09:01 zhangle520

应该没有这个限制,我的demo中也是有MyGridLayout添加到UIScrollView上的情况,出现问题的原因估计是您的MyGridLayout的宽度或者高度约束没有设置的原因吧。具体情况你可以把你的代码私信给我一份。

youngsoft avatar Jan 11 '21 02:01 youngsoft