-, , . iOS 4.0 -
- (void)bang:(float)intensity {
dispatch_async(dispatch_get_main_queue(), ^{
self.view.backgroundColor = [UIColor colorWithWhite:intensity alpha:1];
});
}
NSOperationQueue
- (void)bang:(float)intensity {
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
self.view.backgroundColor = [UIColor colorWithWhite:intensity alpha:1];
}];
}
iOS 3.2 [self performSelectorOnMainThread:@selector(setViewBackgroundColor:) withObject:[UIColor colorWithWhite:intensity alpha:1] waitUntilDone:NO],
- (void)setViewBackgroundColor:(UIColor *)color {
self.view.backgroundColor = color;
}
, [self.view performSelectorOnMainThread:@selector(setBackgroundColor:) withObject:[UIColor colorWithWhite:intensity alpha:1] waitUntilDone:NO] , view UIViewController .