我有一个让我感到困惑的情况。我有一个有2个完全分开的东西的类:一个动画UIImage和一个UILabel。他们有不同的网点,没有连接。线程问题更新标签使UIImageview不可见
当应用程序运行时,它这样做:
dispatch_async(dispatch_get_main_queue(), ^{
[self.monsterMachine setHidden:NO]; //monsterMachine is UIImageView
[self.monsterMachine startAnimating];
});
但后来当我这样做:
[self.futText setText:@"blah"]; // is UILabel
它会导致monsterMachine的UIImageView到不再动画。事情我已经找到:
右键我的setText后:@blah”我可以使用的NSLog观看,看到self.monsterMachine.isAnimated突然变从1到0,即从YES为NO
如果自我。 .futText是ALREADY说“blah”,那么我可以在它上面运行setText:@“blah”多次,并且什么都不会发生,只有当我将其更改为除blah之外的某个值时,UIImageView会停止动画并消失
如果我不使用main_queue显示和动画monsterMachine,它不会显示在所有的,所以我怎么诊断或解决这一问题?
尝试添加[象征性的断点(https://developer.apple.com/library/ ios/recipes/xcode_help-breakpoint_navigator/articles/adding_a_symbolic_breakpoint.html)关于'stopAnimating',看看你是否能从调用树中找出导致它停止动画的原因。 – quantumkid