Capture view contents into an UIImage object

By combining UIGraphicsBeginImageContext() and -renderInContext in CALayer, you can draw contents into a image (UIImage) object. It is like screen capture.

UIGraphicsBeginImageContext(view.frame.size);
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

CGContextTranslateCTM() modifies the x- and y- coordinates (otherwise it starts from (0,0)). By using CGContextTranslateCTM(), you can change the start capturing point so that it can capture limited area in the UIScrollView content.

CGSize pageSize = CGSizeMake(320, 480);
int currentPage = 2;
UIGraphicsBeginImageContext(pageSize);
CGContextRef resizedContext = UIGraphicsGetCurrentContext();
CGContextTranslateCTM(resizedContext, 320 * currentPage, 0);
[scrollView.layer renderInContext:resizedContext];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

Ref:
Capture UIImage with offset into UIScrollView

Repeating background image in native iPhone app – Stack Overflow

Apparently a UIColor is not necessarily a single color, but can be a pattern as well. Confusingly, this is not supported in Interface Builder.

Instead you set the backgroundColor of the view (say, in -viewDidLoad) with the convenience method +colorWithPatternImage: and pass it a UI Image. For Instance:

- (void)viewDidLoad {
  [super viewDidLoad];
  self.view.backgroundColor =
    [UIColor colorWithPatternImage:
       [UIImage imageNamed:@"gingham.png"]];
}

Of course, don’t forget to add the image file to your application bundle.

via Repeating background image in native iPhone app – Stack Overflow.