i think you have to check if the animation did already resume during the current eventloop, or a pause did happen after all. Add thise condition to your resumeAnimation
:
- (void)resumeAnimation
{
if (m_pCustomImageBtnObj != nil)
{
CFTimeInterval pausedTime = [m_pCustomImageBtnObj.layer timeOffset];
if (pausedTime != 0) { // check if resume is called before.
m_pCustomImageBtnObj.layer.speed = 1.0;
m_pCustomImageBtnObj.layer.timeOffset = 0.0;
m_pCustomImageBtnObj.layer.beginTime = 0.0;
CFTimeInterval timeSincePause =
[m_pCustomImageBtnObj.layer convertTime:CACurrentMediaTime()
fromLayer:nil] - pausedTime;
m_pCustomImageBtnObj.layer.beginTime = timeSincePause;
}
}
}