我有以下代码(见下文),如果我编译它,因为我得到“内部编译器错误:总线错误”。如果我注释掉最后一个ImageOne.transform,一切正常。如果文件以.m结尾,如果我将其更改为.mm则编译正常则会出现问题。有什么想法吗?
[UIView animateWithDuration:duration1 delay:delay options:UIViewAnimationCurveEaseIn animations:^{
ImageOne.transform = CGAffineTransformMakeScale(scale1, scale1);
ImageOne.alpha = 1.0f;
}
completion:^(BOOL finished){
[UIView animateWithDuration:SecondDuration delay:SecondDelay options:UIViewAnimationCurveEaseOut animations:^{
ImageOne.transform = CGAffineTransformMakeScale(scale2, scale2);
}
completion:^(BOOL finished){
[UIView animateWithDuration:SecondDuration delay:SecondDelay options:UIViewAnimationCurveEaseOut animations:^{
ImageOne.transform = CGAffineTransformMakeScale(scale1, scale1); //results in bus error, i think its due to nesting
}
completion:nil];
}];
}];
}
答案 0 :(得分:1)
为什么要嵌套另一个块,而不是仅添加
ImageOne.transform = CGAffineTransformMakeScale(scale1, scale1);
进入第一个区块就像这样
completion:^(BOOL finished)
{
[UIView animateWithDuration:SecondDuration delay:SecondDelay options:UIViewAnimationCurveEaseOut animations:^{
ImageOne.transform = CGAffineTransformMakeScale(scale1, scale1);
ImageOne.transform = CGAffineTransformMakeScale(scale2, scale2);
希望这会有所帮助。 :)