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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:46:51+00:00 2026-06-14T17:46:51+00:00

I’m trying to update the items in a UITableViewCell connected to my root view

  • 0

I’m trying to update the items in a UITableViewCell connected to my root view table via a UIButton in my detail view. The item cell is imported into the root view, loaded and registered in viewDidLoad, updated in viewDidAppear, and added to the table in tableView:cellForRowAtIndexPath.

- (IBAction)addItem:(id)sender
{
//saves new list
RoomItem *item = [[RoomItem alloc] initWithRoom:[_roomTxt text] Building:[_buildingTxt text]];
[[RoomList sharedStore] createItem:item];

//allows for immediate return to rootView upon action (save button push in this case)
[self.navigationController popToRootViewControllerAnimated:YES];

}

Even though Xcode predicts “createItem”, I get a warning that “No visible @interface for ‘RoomList’ declares the selector ‘createItem:’

I’ve imported RoomList.h, where:

- (RoomItem *)createItem;
+ (RoomList *)sharedStore;

In RoomList.m:

- (RoomItem *)createItem
{
//tracks what number item it's creating
double order;
if ([allItems count] == 0) {
    order = 1.0;
}
else
{
    order = [[[allItems lastObject] objectIndex] doubleValue] + 1.0;
}
NSLog(@"Adding after %d items, order = %.2f", [allItems count], order);
RoomItem *p = [NSEntityDescription insertNewObjectForEntityForName:@"RoomItem"
                                        inManagedObjectContext:context];
[p setRoom:[NSString string]];  //there was an order call here
[p setBuilding:[NSString string]];
[p setBuildingThumbnail:[UIImage imageNamed:[NSString string]]];    //may need to be changed to another imageNamed function
[p setBuildingThumbnailData:[NSData data]];
[p setObjectIndex:[NSNumber numberWithDouble:order]];
[allItems addObject:p];

return p;
}
+ (RoomList *)sharedStore
{
static RoomList *sharedStore = nil;
if (!sharedStore) {
    sharedStore = [[super allocWithZone:nil] init];
}
return sharedStore;
}
+ (id)allocWithZone:(NSZone *)zone
{
return [self sharedStore];
}

In RoomItem I have:

- (id)initWithRoom:(NSString *)room Building:(NSString *)building;

I just can’t wrap my head around what I could be missing here. Any thoughts?

Thanks.

Edit (root view method that writes to item cell):

- (UITableViewCell *)tableView:(UITableView *)tableView
     cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
BNRItem *p = [[[BNRItemStore defaultStore] allItems]
                                objectAtIndex:[indexPath row]];
//[[cell textLabel] setText:[p description]];

//get the new or recycled cell
HomepwnerItemCell *cell = [tableView dequeueReusableCellWithIdentifier:@"HomepwnerItemCell"];

[cell setController:self];
[cell setTableView:tableView];

//configure the cell with the BNRItem
[[cell nameLabel] setText:[p itemName]];
[[cell serialNumberLabel] setText:[p serialNumber]];
[[cell valueLabel] setText:[NSString stringWithFormat:@"$%d", [p valueInDollars]]];

[[cell thumbnailView] setImage:[p thumbnail]];

return cell;
}

This is what worked for me. It seems I was not properly fetching the core data entity. However, the objectAtIndex query is still an issue since it only updates the RoomItem at index:0. How can a get the index of the RoomItem I’m trying to update?

- (RoomItem *)updateItemWithRoom:(NSString *)room Building:(NSString *)building
{
NSError *error = nil;

NSEntityDescription *entity = [NSEntityDescription entityForName:@"RoomItem" inManagedObjectContext:context];
NSFetchRequest *request = [[NSFetchRequest alloc] init];
[request setEntity:entity];

RoomItem *currentRoomItem = [[context executeFetchRequest:request error:&error] objectAtIndex:0];
request = nil;

[currentRoomItem setRoom:room];
[currentRoomItem setBuilding:building];

[self saveChanges];

return currentRoomItem;
}
  • 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-06-14T17:46:52+00:00Added an answer on June 14, 2026 at 5:46 pm

    Your question title is about master/detail view controller communication. But a compiler warning seems to be at the heart of your question.

    It’s a matter of method signatures.

    [[RoomList sharedStore] createItem:item];
    

    This calls method signature is -createItem:. You declare -(RoomItem *)createItem; or -createItem. Note there’s no colon, no passed in parameter.

    It seems unlikely that you would pass a RoomItem in to a method named createItem so you likely want to just change the above call to:

    RoomItem *item = [[RoomList sharedStore] createItem];
    // item is now the newly created entity.
    

    Or change the createItem method to something like:

    -(RoomItem *)createItemWithRoom:(NSString *)room andBuilding:(NSString *)building{
        // Use room & building to create managed object
    }
    

    And then use it like:

    RoomItem *item = [[RoomList sharedStore] createItemWithRoom:[_roomTxt text] andBuilding:[_buildingTxt text]];
    

    EDIT

    If you’re trying to refresh the master tableview in the detail view of a split view controller (on iPad) you can use code like this to reload the master tableview.

    UINavigationController *masterController = [self.splitViewController.viewControllers objectAtIndex:0];
    UITableViewController *tableController = (UITableViewController *)masterController.visibleViewController;
    UITableView *tableView = tableController.tableView;
    [tableView reloadData];
    

    On the iPhone/iPod you can obtain the navigation controllers root view controller and refresh the table view with code like this.(written a bit more compactly)

    UITableViewController *masterTableViewController = [self.navigationController.viewControllers objectAtIndex:0];
    [masterTableViewController.tableView reloadData];
    

    Of course instead of a full reload you could use a method like insertRowsAtIndexPaths:withRowAnimation: if you know the future indexPath(s) at the time of insertion.

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

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to select an H1 element which is the second-child in its group
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;

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.