0

It is said that for a single view app, it can be a programming choice to keep the current main view's content in a bitmap, and we paint extra things on this bitmap, and when it is time to do drawRect (when called by iOS), then we just display the bitmap. (instead of redrawing 50,000 things every time drawRect is called. Just draw them once onto the bitmap instead).

Do somebody know exactly how to do it? Exact code will be appreciated (probably requires code for 2 different files, one for ViewController.m and one for MainView.m), or can point to sample code snippet (nothing fancy please, just the simplest understandable code that can do this). Thanks.

Peter Hosey
  • 95,783
  • 15
  • 211
  • 370
Sarah W
  • 889
  • 1
  • 6
  • 10

1 Answers1

2

As discussed in this previous question, you need to:

  1. Create an image context.
  2. Draw into it.
  3. Get the image from it.
  4. Pop it.
Community
  • 1
  • 1
Peter Hosey
  • 95,783
  • 15
  • 211
  • 370