I'm aware that the UI should only be updated on the main thread, but is it possible to create and add subviews on a separate thread, as long as they are not added to the visible view? Will it cause memory and performance issues? Here's some example code.
NSOperationQueue *queue = [[NSOperationQueue alloc] init];
[queue addOperationWithBlock:^{
// do some fancy calculations, building views
UIView *aView = ..
for (int i, i<1000, i++)
{
UIView *subView = …
[aView addSubview:subView];
}
// Update UI on Main Thread
[queue addOperationWithBlock:^{
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
// Update the interface
[self.view addSubview:aView];
}];
}];
}];