首页 > 移动平台 > 详细

IOS 执行动画后想要调用某个方法

时间:2015-04-01 15:26:54      阅读:157      评论:0      收藏:0      [点我收藏+]

第一种方法:,使用监听

UIView beginAnimations

方法如下:

    [UIView beginAnimations:nil context:nil];
    //代理,监听对象
    [UIView setAnimationDelegate:self];
    //<span style="font-family: Arial, Helvetica, sans-serif;">removeCover 是动画执行完后要调用方法</span>
    [UIView setAnimationDidStopSelector:@selector(removeCover)];
    self.coverBtn.alpha =0.0;
    [UIView commitAnimations];

removeCover:

-(void)removeCover
{
    [self.coverBtn removeFromSuperview];
    self.coverBtn=nil;
}

第二种方法:使用block,   UIView animateWithDuration

    [UIView animateWithDuration:1.0 animations:^{
        self.coverBtn.alpha= 0.0;
        self.iconbtn.frame = self.oldPicFrame;
        
    } completion:^(BOOL finished) {
        [self.coverBtn removeFromSuperview];
        self.coverBtn =nil;
    }];


IOS 执行动画后想要调用某个方法

原文:http://blog.csdn.net/xuejunling/article/details/44806067

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!