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

  • SEARCH
  • Home
  • 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 4538094
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T14:45:53+00:00 2026-05-21T14:45:53+00:00

I know this is going to be somewhat hard to answer, but I need

  • 0

I know this is going to be somewhat hard to answer, but I need to save text and images into a single file (like photoshop does). Should I make a custom file type, or is there another way to do this?

If I need a custom file type, would somebody please give me link to something that may help me make the file type store the data properly? If there is another way, how can I do this?

NOTE: I am using this in a application that imports three images, and lets users put text over them, so I may not be able to get the information needed to store the images as text in any way. If it is what I have to do, I will need a link to some helpful information.

  • 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-21T14:45:54+00:00Added an answer on May 21, 2026 at 2:45 pm

    An easy way to save objects to a file is to add them to an NSDictionary and then use NSArchiver to archive the dictionary into data.

    For example in a document based app:

    - (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError {
        if ([typeName isEqualToString:@"YourTypeName"]) {
              //Create a Dictionary
              NSMutableDictionary *dictToSave = [NSMutableDictionary dictionary];
              //Add the first image to the dictionary
              [dictToSave setObject:image1 forKey:@"Image1"];
              //Add the first image's text
              [dictToSave setObject:image1text forKey:@"Image1Text"];
              //etc.
              [dictToSave setObject:image2 forKey:@"Image2"];
              [dictToSave setObject:image2text forKey:@"Image2Text"];              
              [dictToSave setObject:image3 forKey:@"Image3"];
              [dictToSave setObject:image3text forKey:@"Image3Text"];
              //Return the archived data
              return [NSArchiver archivedDataWithRootObject:dictToSave];
        }
        //Don't generate an error
        outError = NULL;
        return nil;
    }
    

    To read this data, just unarchive the dictionary and set the objects:

    - (BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName
    error:(NSError **)outError {
        if ([typeName isEqualToString:@"MyTypeName"]) {
            NSMutableDictionary *readDict = 
            [NSUnarchiver unarchiveRootObjectWithData:data];
            image1 = [readDict objectForKey:@"Image1"];
            image1text = [readDict objectForKey:@"Image1Text"];
            image2 = [readDict objectForKey:@"Image2"];
            image2text = [readDict objectForKey:@"Image2Text"];
            image3 = [readDict objectForKey:@"Image3"];
            image3text = [readDict objectForKey:@"Image3Text"];
        }
        outError = NULL;
        return YES;
    }
    

    You will also need to define your custom file type in your app’s plist file.

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

Sidebar

Related Questions

I know this is somewhat subjective, but I can't find an honest answer anywhere.
I know this one is going to be a long-shot, but I thought I'd
Right, I know I am totally going to look an idiot with this one,
I know this might be a no-brainer, but please read on. I also know
I know this isn't strictly a programming question but y'all must have experienced this.
I know this is a broad question, but I've inherited several poor performers and
I know this is not programming directly, but it's regarding a development workstation I'm
I know this rather goes against the idea of enums, but is it possible
I know this would be easy with position:fixed, but unfortanately I'm stuck with supporting
I know this site is written using ASP.Net MVC and I do not see

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.