gpt4 book ai didi

ios - 淡入淡出动画太慢

转载 作者:行者123 更新时间:2023-11-28 19:41:22 28 4
gpt4 key购买 nike

我制作了一个动画,在一个单元格上淡入淡出。当我按下单元格(整个单元格上的一个按钮)时,操作通过 collectionView 上的协议(protocol)进行委托(delegate)并弹出到另一个 Controller (detailController)。

细胞

 - (IBAction)cellButtonPressed:(id)sender {
[self fadeIn];
}

-(void)fadeIn {
[UIView animateWithDuration:0.5
delay:0.0
options:0.0
animations:^{
self.coverAlbumPhoto.alpha = 0.0f;
self.shadowView.alpha = 0.0f;
self.mountainBorderImageView.alpha = 0.0f;

} completion:^(BOOL finished) {
[self fadeOut];
}];
}
-(void)fadeOut {
[UIView animateWithDuration:0.5
delay:0.0
options:0.0
animations:^{
self.coverAlbumPhoto.alpha = 1.0f;
self.shadowView.alpha = 1.0f;
self.mountainBorderImageView.alpha = 1.0f;

} completion:^(BOOL finished) {
if ([self.delegate respondsToSelector:@selector(tapCellButtonAtIndexPath:)]) {
[self.delegate tapCellButtonAtIndexPath:self.indexPath];
}
}];
}

Collection View

(void)tapCellButtonAtIndexPath:(NSIndexPath *)indexPath {
ArtworkModel *artworkModel = (ArtworkModel *)[listOfArtworks objectAtIndex:indexPath.row];

FBWorkDetailsViewController *dvc = [[FBWorkDetailsViewController alloc] initWithArtwork:artworkModel];
FBLeftMenuViewController *left = [[FBLeftMenuViewController alloc] init];
MFSideMenuContainerViewController *container = [MFSideMenuContainerViewController
containerWithCenterViewController: dvc
leftMenuViewController: left
rightMenuViewController:nil
withHeader: YES];
[container.titleLabel setText:@"WORK DETAILS"];
[self.navigationController pushViewController: container animated: YES];
}

问题是动画太慢了。谁能解释我为什么?谢谢。

最佳答案

您有 2 个动画,每个动画的持续时间为 0.5 秒。这给出了 1 秒的总持续时间。如果您希望它更快,请使用更短的持续时间。 0.2 到 0.3 秒的总动画时间可能是一个不错的起点,因此请尝试将每个步骤的持续时间减少到 0.15 秒(总共 0.3 秒)。

关于ios - 淡入淡出动画太慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34180888/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com