Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4615972
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:54:59+00:00 2026-05-22T01:54:59+00:00

My fellow developer and I are creating an iPhone app that is creating a

  • 0

My fellow developer and I are creating an iPhone app that is creating a composite image. The idea is to have 36 images in a 6×6 grid. Each original image is 400x300px. Hence the final image after processing should be 2400x1800px.

Disclaimer: I’m not doing this programming myself in particular. My fellow programmer is not on SO and for various reasons I’m compelled to ask for him. I’m personally a .Net developer so forgive my question if it’s obvious.

Now, apparently this is creating memory issues. His solution thus far has been attempts to draw the composition to an UIImageView or CATiledLayer, and saving the composition by taking a screenshot of the view. All attempts thus far have either crashed the application due to memory issues, or produced black areas in the composition.

My question is presumably simple. How do we create a large (offscreen?) image, draw the 36 partial images to this composition, save the composition, then put it in an appropriate component that can be viewed by the user?

Edit:

My buddy found the solution himself in the end. I’ll post it here together with the accepted answer in order to contribute to the SO wiki 🙂

UIGraphicsBeginImageContext(svPreview.contentSize);
    CGContextRef ctx = UIGraphicsGetCurrentContext();
    CGContextSetFillColorWithColor(ctx, [[UIColor blackColor] CGColor]);
    CGContextFillRect(ctx, CGRectMake(0, 0, svPreview.contentSize.width, svPreview.contentSize.height));

    for(UIImageView *subview in [svPreview subviews]) {
        [subview.image drawAtPoint:subview.frame.origin];
    }

    UIImage *rawImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    UIImageWriteToSavedPhotosAlbum(rawImage, self, nil, nil);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T01:55:00+00:00Added an answer on May 22, 2026 at 1:55 am

    The obvious mechanism would be a UIScrollView. It’s an object meant to display an image, or a group of images, that are bigger than the screen, and it comes with easily implementable functionality to zoom and scroll.

    You’ll find a good primer in Apple’s Scroll View’s Programming Guide to iOS.

    You would just need to

    1. create a new scroll view
    2. set its contentSize property to the total size of the extra large image you want to display
    3. add either the one large image as a subview, or add all the small images, placing them appropriately to fit together

    If you wanted to make the one large image, you could just create a large custom view that’s the same size as the scroll view’s contentSize. Then, draw each smaill image in its own grid. Finally, add this large custom view as the scroll view’s subview.

    This is the obvious solution, but it might do everything you’re looking for, and afford you some extra functionality.

    Edit: A scroll view may be a good starting point, but you may still hit memory limitations. Searching for answers on making scroll views more efficient may be helpful. You may find some good ideas in this related question: ScrollView runs out of memory when it gets too big

    Edit 2: The way to manage memory is detailed, code and all, in the above-mentioned guide. Take a look at the ScrollViewSuite demo’s third example, on tiling. That should work perfectly for you since your image is already composed of tiles.

    The idea is to make a sort of table view out of the scroll view that now recycles image tiles instead of cells. The scroll view is subclassed and a set of reusable tiles is kept as one of its instance variables. The key to the implementation is, in layoutSubviews, to remove from superview the tiles that have moved out of the visible area, then recycle tiles for newly visible content and add them as subview. In this way, only visible tiles are loaded into memory.

    Hope this works for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have SVN server on out intranet (192.168.x.x) for me and my fellow developer
I have the following code snippet which uses'event' My fellow developers argue that the
I'm working with some code in Visual Studio. My parter-in-crime fellow developer has suggested
fellow anthropoids and lily pads and paddlewheels! I'm developing a Windows desktop app in
Avast there fellow programmers! I have the following problem: I have two rectangles overlapping
Here is an interesting piece of code that my fellow team members were just
Ok, I have just run into something that is really catching me off-guard. I
I have several MS Access queries (in views and stored procedures) that I am
A fellow developer and I are putting together a proposal for a new application,
Quite often I have unit tests using MSTest for code that is in a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.