Closed GaoDaobin closed 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; }
}
已经解决
发现一个bug,dang当选中tab2,然后滑动到tab7并选中,在滑动惠tab2,此时tab2还是红色