pagecontrol 会随着cell的复用 间距会越来越大
Closed this issue · 11 comments
在cell复用时候越来越大 wBannerControlSelectMargin 属性累加了
在cell复用时候越来越大 wBannerControlSelectMargin 属性累加了
看了下没有累加哦 你是cell初始化的时候加上去的吗
用的懒加载方式,可能表达有误,是pagecontrol的dot的frame越来越大,造成看着离的越来越远,原因是 pagecontrol的frame 第二次时候已经不是你初始化的原来frame了,我在- (void)resetCollection{
self.bannerControl.frame = CGRectMake((self.bounds.size.width - 60)/2 , self.bounds.size.height - 30,60, 30);
self.bannerControl.numberOfPages = self.data.count;
self.bannerControl.hidden = self.param.wHideBannerControl;
if (self.data.count == 1) {
self.bannerControl.hidden = YES;
}
第一行加了下代码 就没问题了
cell 里面使用该控件的代码
if (!kArrayIsEmpty(model.selectImage)) {
self.param.wDataSet([model.selectImage valueForKeyPath:@"imgPath"]);
BOOL hasOne = (self.param.wData.count == 1) ;
CGFloat height = hasOne ? CYScaleW_Precise(240) : CYScaleW_Precise(240 + 26);
[self.contentV mas_updateConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(height).priorityHigh();
}];
self.contentV.hidden = false;
self.param.wSelectIndexSet(model.currentPageIndex);
self.param.wRepeatSet(hasOne ? false : true);
}else{
self.param.wDataSet(@[]);
[self.contentV mas_updateConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(0).priorityHigh();
}];
self.contentV.hidden = true;
}
[self.cycleView updateUI];
// [self.cycleView makeScrollViewScrollToIndex:model.currentPageIndex];
}
-
(WMZBannerView *)cycleView{
if (!_cycleView) {
_cycleView =[[WMZBannerView alloc] initConfigureWithModel:self.param] ;
// _cycleView.delegate = self;
}
return _cycleView;
}
-
(WMZBannerParam *)param{
if (!_param) {
_param =[[WMZBannerParam alloc] init] ;
_param.wBannerControlColorSet(UIColorHex(d8d8d8));
_param.wBannerControlSelectColorSet(NLMainColor);
_param.wRepeatSet(YES);
_param.wFrameSet(CGRectMake(0, 0, CYScreenW, CYScaleW_Precise(240)));
_param.wPlaceholderImageSet(@"mine_dynamic_4");
// _param.wBannerControlImageSizeSet(CGSizeMake(10, 10));
// _param.wBannerControlSelectImageSizeSet(CGSizeMake(10, 10));
_param.wBannerControlSelectMarginSet(10);
_param.wCustomControl = ^(UIControl *pageControl) {
pageControl.cy_y = CYScaleW_Precise(240);
};}
return _param;
}
cell 里面使用该控件的代码
if (!kArrayIsEmpty(model.selectImage)) { self.param.wDataSet([model.selectImage valueForKeyPath:@"imgPath"]); BOOL hasOne = (self.param.wData.count == 1) ; CGFloat height = hasOne ? CYScaleW_Precise(240) : CYScaleW_Precise(240 + 26); [self.contentV mas_updateConstraints:^(MASConstraintMaker *make) { make.height.mas_equalTo(height).priorityHigh(); }]; self.contentV.hidden = false; self.param.wSelectIndexSet(model.currentPageIndex); self.param.wRepeatSet(hasOne ? false : true); }else{ self.param.wDataSet(@[]); [self.contentV mas_updateConstraints:^(MASConstraintMaker *make) { make.height.mas_equalTo(0).priorityHigh(); }]; self.contentV.hidden = true; } [self.cycleView updateUI]; // [self.cycleView makeScrollViewScrollToIndex:model.currentPageIndex];
}
- (WMZBannerView *)cycleView{
if (!_cycleView) {
_cycleView =[[WMZBannerView alloc] initConfigureWithModel:self.param] ;
// _cycleView.delegate = self;
}
return _cycleView;}
- (WMZBannerParam *)param{
if (!_param) {
_param =[[WMZBannerParam alloc] init] ;
_param.wBannerControlColorSet(UIColorHex(d8d8d8));
_param.wBannerControlSelectColorSet(NLMainColor);
_param.wRepeatSet(YES);
_param.wFrameSet(CGRectMake(0, 0, CYScreenW, CYScaleW_Precise(240)));
_param.wPlaceholderImageSet(@"mine_dynamic_4");
// _param.wBannerControlImageSizeSet(CGSizeMake(10, 10));
// _param.wBannerControlSelectImageSizeSet(CGSizeMake(10, 10));
_param.wBannerControlSelectMarginSet(10);
_param.wCustomControl = ^(UIControl *pageControl) {
pageControl.cy_y = CYScaleW_Precise(240);
};
}
return _param;}
哦 你这是在cell的时候调用了刷新是吧。 是的 那就重新需要reset的时候再设置一下control的frame可解决
是的,我的cell里面都是这种轮播图,数据每行都会变,怎么重新设置frame 用哪个方法啊_param.wCustomControl = ^(UIControl *pageControl) {
pageControl.cy_y = CYScaleW_Precise(240);
};这个么
或者是我使用姿势有误吗,在tableviewcell 复用时候,每个控件数据不同情况下,我该调用updateUI吗
或者是我使用姿势有误吗,在tableviewcell 复用时候,每个控件数据不同情况下,我该调用updateUI吗
cell的时候使用少 应该是要调用的updateUI的 用你加的那个代码就行了 wCustomControl应该不行
下次更新可以把代码带上吗,我现在用改源码方式使用
下次更新可以把代码带上吗,我现在用改源码方式使用
GitHub带上了 pod还没更新
好的,辛苦了
!