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 6859879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:20:17+00:00 2026-05-27T02:20:17+00:00

I have a scenario that i suspect is very common, i’ve found various ideas

  • 0

I have a scenario that i suspect is very common, i’ve found various ideas in responses to other similar questions including setting up IBOutlets, passing NSmanagedobjects as properties and just using one view controller but swapping out the views but I’m uncertain as to which would be the best idea to implement for my solution.

I have an iOS/iphone app that has a typical model. UITabBarController containing multiple UINavigationControllers.

In one of the navigation controllers i have a viewcontroller with a tableView in it. This tableView is populated from fetched core Data entity is called ‘tags’. When I set the tableView up with a UIBarButtonItem (Add) the add button needs to behave as follows: I need it to create a new ‘tag’ object for that entity and populate the object with some known data and then prompt the user to drill down 3 levels of classification (Region -> area -> topic) to reach a topic object. i then need to add that ‘topic’ object to a relationship of the original newly added ‘tag’ object (3 views further down the stack). – hope thats clear.

(there’s lots of code I’m not sure which bits to present so i’m describing for now with the main snippet, by all means let me know any specific code you’d like to see.)

- (void)addTag {    

NSManagedObjectContext *context = [self.fetchedResultsController managedObjectContext];
NSEntityDescription *entity = [[self.fetchedResultsController fetchRequest] entity];
NSManagedObject *newManagedObject = [NSEntityDescription insertNewObjectForEntityForName:[entity name] inManagedObjectContext:context];
[newManagedObject setValue:@"(untitled)" forKey:@"tagID"];

NSError *error;
if (![context save:&error])
    NSLog(@"Error saving entity: %@", [error localizedDescription]);


ChooseRegion *aView = [[[ChooseRegion alloc] init] autorelease];
aView.theTag = newManagedObject;

[self.navigationController pushViewController:aView animated:YES];

}

You can see I’ve created the object, set one of it’s properties a value, saved it and passed the object to the next view (chooseRegion) which is the first of 3 views. on each the didSelectRowAtIndexPath code passes the selected row and this ‘tag’ object to the next view, i’m not sure whether this is right because i’m not sure what to do when i get to the topic object on the 3rd view??? i’m lost.

Always more than one way to skin a cat but what approach should i be tackling this from. Should I be passing the ‘tag’ object forward and save it at the 3rd view or pass back the selected topic and save it at the original view which created the ‘tag’ object?

Many thanks in advance.

  • 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-27T02:20:18+00:00Added an answer on May 27, 2026 at 2:20 am

    I would use notifications for this. Notifications are a simple way to decouple parts of the application, but still have them work together.

    In your case, the moment the user selects the tag object in the 3rd view, I would send a notification as such:

    [[NSNotificationCenter defaultCenter] postNotificationName:@"tagSelected" object:myTag];
    

    Now, in the controller that has the “add” button, make it subscribe to that event:

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleTagSelected:) name:@"tagSelected" object:nil];
    

    Make sure you implement the handleTagSelected: method, and in that method you can get the tag object and close the drilldown view that you have open:

    - (void)handleTagSelected:(NSNotification *)notification {
        Tag *mytag = (Tag *)notification.object;
        [self dismissModalViewControllerAnimated:YES];
    }
    

    Then you can do whatever you want with the tag.

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

Sidebar

Related Questions

Common scenario: I have a library that uses other libraries. For example, a math
I have a path defined: when /the admin home\s?page/ /admin/ I have scenario that
I have a scenario that my load balancer translates port 80 from outside into
I have a scenario that I haven't been able to solve: I'm toying around
Here is the scenario that I have. I have a cvs repository in one
I'm trying to write a Cucumber scenario that requires me to have a logged
Beginner level question Scenario: Have simple string cocantation tool, that I might expand later
The scenario: we have a web system that automatically generates office 2003 excel files
Scenario: I have a text file that has pipe (as in the | character)
Scenario: I have a console application that needs to access a network share with

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.