Tag: 谷歌现在

Google即时喜欢iOS上的界面

所以,我绝对喜欢Android上的Google Now卡片界面。最近它甚至来到了iOS。 有没有任何教程或示例项目可以帮助我创build我的iOS应用程序的卡界面? 从我的研究中,我已经能够使用自定义的UICollectionViewFlowLayout来复制“堆叠”的卡片。 – (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect { NSArray *allAttributesInRect = [super layoutAttributesForElementsInRect:rect]; CGPoint centerPoint = CGPointMake(CGRectGetMidX(self.collectionView.bounds), CGRectGetMidY(self.collectionView.bounds)); for (UICollectionViewLayoutAttributes *cellAttributes in allAttributesInRect) { if (CGRectContainsPoint(cellAttributes.frame, centerPoint)) { cellAttributes.transform = CGAffineTransformIdentity; cellAttributes.zIndex = 1.0; } else { cellAttributes.transform = CGAffineTransformMakeScale(0.75, 0.75); } } return allAttributesInRect; } 然后我将最小行间距设置为负值,使它们显示为“堆叠”。 滚动,但我想卡留在底部,只有1辆汽车放大和屏幕中心。 然后我将该卡从屏幕上滚动下来,堆栈中的下一张“卡”将从堆叠中向上滚动并在屏幕上居中。 我猜这将是dynamic调整最小行距?