Question: I know UIView are not thread safe so i cant add a view on a background thread, to work around this is it ok to create a UIView on a background thread then add it on the main thread?

Note: the reason im not doing this on the main thread is because my actual code is a lot more complex and therefor takes a while to create all the views and fill the values. I dont want the UI to become un-responsive when I do this so im trying to work around this.

for example..

```
-(void)addLabel//called on background thread
{
    UILabel * label = [[UILabel alloc]initWithFrame:CGRectMake(0,0,40,100)];
    [label setText:@"example"]
    [self.view performSelector:@selector(addSubview:) onThread:[NSThread mainThread] withObject:example waitUntilDone:YES];
}

```

Thanks in advance.

Answer: 
I use Xcode Version 9.0 beta 3 (9M174d), receiving a warning.

> 
> [UView init] must be called from main thread only
> 
> 
> 

So I think you should create UI in main thread better

Show the picture below :

[![enter image description here](https://i.stack.imgur.com/Hk8xV.png)](https://i.stack.imgur.com/Hk8xV.png)
The [Drawing and Printing Guide](http://developer.apple.com/library/ios/#documentation/2ddrawing/conceptual/drawingprintingios/graphicsdrawingoverview/graphicsdrawingoverview.html) states:

> 
> Important The UIKit classes are generally not thread safe. All drawing-related operations should be performed on your application’s main thread.
> 
> 
> 

Thus, as I understand this, it seems that the only problem is related to "drawing-related operations". If we assume that a correct class only execute such operation in its `drawRect:` method, then the approach you suggest should be fine.