12207480 / TYPagerController

page scroll view and controller,simple,high custom,and have many tabBar styles,,support Objective-C and swift
MIT License
1.37k stars 231 forks source link

发现一个bug #21

Closed GaoDaobin closed 7 years ago

GaoDaobin commented 8 years ago

img_0419 发现一个bug,dang当选中tab2,然后滑动到tab7并选中,在滑动惠tab2,此时tab2还是红色

robinvpersie commented 7 years ago

在CollectionView的代理里面再重新配置Cell的颜色和transform。自己加了一个代理方法 /////// -(void)collectionView:(UICollectionView )collectionView willDisplayCell:(UICollectionViewCell )cell forItemAtIndexPath:(NSIndexPath *)indexPath{

TYTabTitleViewCell * displyacell = (TYTabTitleViewCell *)cell;
[self.delegate pagerController:self configreDisplayCell:displyacell isCurrent:indexPath.item == self.curIndex? YES : NO atIndexPath:indexPath];

}

////// -(void)pagerController:(TYTabPagerController )pagerController configreDisplayCell:(UICollectionViewCell )cell isCurrent:(BOOL)current atIndexPath:(NSIndexPath )indexPath{ TYTabTitleViewCell titleCell = (TYTabTitleViewCell *)cell; if (current) { titleCell.titleLabel.textColor = self.selectedTextColor; titleCell.transform = CGAffineTransformIdentity; }else { titleCell.transform = CGAffineTransformMakeScale(self.selectFontScale, self.selectFontScale); titleCell.titleLabel.textColor = self.normalTextColor; }

}

12207480 commented 7 years ago

已经解决