我想要在專用於音頻的線程中運行的事件來更改UI。簡單地調用view.backgroundColor似乎沒有任何效果。iOS:從運行循環外部設置UIView背景顏色
這裏是我的viewController中的兩個方法。第一個是觸摸觸發的。第二個是從音頻代碼中調用的。第一部作品。第二。任何想法爲什麼?
// this changes the color
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
[touchInterpreter touchesMoved:touches withEvent:event];
self.view.backgroundColor = [UIColor colorWithWhite: 0.17 + 2 * [patch getTouchInfo]->touchSpeed alpha:1];
};
// this is called from the audio thread and has no effect
-(void)bang: (float)intensity{
self.view.backgroundColor = [UIColor colorWithWhite: intensity alpha:1];
}
任何想法爲什麼?我只是在做一些愚蠢的事情,還是有一種竅門可以從運行循環之外改變UI元素?
非常感謝! – morgancodes 2010-11-05 12:48:36