<p>I want to stitch 2 pieces of png side by side. In Cocoa, I would use [NSImage initWithSize], and then just drawInRect. </p>

<p>But UIImage don't have initWithSize class, how would I do this now?</p>

Use
```
UIGraphicsBeginImageContext()
```
, draw in it, then use
```
UIGraphicsGetImageFromCurrentImageContext()
```
. Remember to pop the context with
```
UIGraphicsEndImageContext()
```
afterwards.
You should avoid creating an extra image if you simply want to display the two images onscreen, due to the limited memory available on the device. Instead, display them using appropriate
```
drawInRect:
```
calls to avoid copying.