您的位置:首页 > 产品设计 > UI/UE

UITableViewCell和UICollectionView的几种动画

2015-09-15 22:09 316 查看
tableView 的动画

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath

{

cell.frame = CGRectMake(self.view.frame.size.width * 2, cell.frame.origin.y, cell.frame.size.width, cell.frame.size.height);

[UIView animateWithDuration:0.5 animations:^{

cell.frame = CGRectMake(0, cell.frame.origin.y, cell.frame.size.width, cell.frame.size.height);

} completion:^(BOOL finished) {

;

}];

}

collectionView的动画

- (void)collectionView:(UICollectionView *)collectionView willDisplayCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath

{

CGRect newFrame = cell.frame;

cell.frame = CGRectMake(0, 0, cell.frame.size.width, cell.frame.size.height);

[UIView animateWithDuration:0.5 animations:^{

cell.frame = newFrame;

} completion:^(BOOL finished) {

;

}];

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: