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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T01:26:52+00:00 2026-06-03T01:26:52+00:00

Am getting repeated issues in ItemsViewController.m even though I have not changed anything in

  • 0

Am getting repeated issues in ItemsViewController.m even though I have not changed anything in the relevant methods. Before there were some issues which I asked about on SO earlier, then corrected them, but they have popped up again. Have not made any changes to the methods/areas which are kicking up a fuss again. Have commented out the problem areas.

Could there be compiler issues?

Here is the file; thanks in advance.

ItemsViewController.m

#import "ItemsViewController.h"
#import "BNRItemStore.h"
#import "BNRItem.h"

@implementation ItemsViewController //@end is missing in implementation context

- (id)init 
{
  // Call the superclass's designated initializer
  self = [super initWithStyle:UITableViewStyleGrouped];
  if (self) {
    UINavigationItem *n = [self navigationItem];

    [n setTitle:@"Homepwner"];

    // Create a new bar button item that will send
    // addNewItem: to ItemsViewController
    UIBarButtonItem *bbi = [[UIBarButtonItem alloc] 
                            initWithBarButtonSystemItem:UIBarButtonSystemItemAdd 
                            target:self 
                            action:@selector(addNewItem:)];

    // Set this bar button item as the right item in the navigationItem
    [[self navigationItem] setRightBarButtonItem:bbi];

    [[self navigationItem] setLeftBarButtonItem:[self editButtonItem]];
  }
  return self;
}

- (IBAction)addNewItem:(id)sender
{
  // Create a new BNRItem and add it to the store
  BNRItem *newItem = [[BNRItemStore defaultStore] createItem];

  DetailViewController *detailViewController = [[DetailViewController alloc]initForNewItem:YES];

  [detailViewController setItem:newItem];

  [detailViewController setDismissBlock:^{[[self tableView]reloadData];

  UINavigationController *navController = [[UINavigationController alloc]initWithRootViewController:detailViewController];

  [navController setModalPresentationStyle:UIModalPresentationFormSheet];

  [self presentViewController:navController animated:YES completion:nil];


  }

- (id)initWithStyle:(UITableViewStyle)style //use of undeclared identifier 'initWithStyle'
{
  return [self init];
}

- (void)viewWillAppear:(BOOL)animated
{
  [super viewWillAppear:animated];
  [[self tableView] reloadData];
}

- (void)tableView:(UITableView *)tableView 
moveRowAtIndexPath:(NSIndexPath *)fromIndexPath 
      toIndexPath:(NSIndexPath *)toIndexPath 
{
  [[BNRItemStore defaultStore] moveItemAtIndex:[fromIndexPath row] 
                                       toIndex:[toIndexPath row]];
}



- (void)tableView:(UITableView *)aTableView 
didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
  DetailViewController *detailViewController = [[DetailViewController alloc] initForNewItem:NO];

  NSArray *items = [[BNRItemStore defaultStore] allItems];
  BNRItem *selectedItem = [items objectAtIndex:[indexPath row]];

  // Give detail view controller a pointer to the item object in row
  [detailViewController setItem:selectedItem];

  // Push it onto the top of the navigation controller's stack
  [[self navigationController] pushViewController:detailViewController
                                         animated:YES];
}



-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)io
{
  if ([[UIDevice currentDevice]userInterfaceIdiom]==UIUserInterfaceIdiomPad) {
    return YES;
  } else {
    return (io==UIInterfaceOrientationPortrait);
  }
}

- (void)tableView:(UITableView *)tableView 
commitEditingStyle:(UITableViewCellEditingStyle)editingStyle 
forRowAtIndexPath:(NSIndexPath *)indexPath 
{
  // If the table view is asking to commit a delete command...
  if (editingStyle == UITableViewCellEditingStyleDelete)
  {
    BNRItemStore *ps = [BNRItemStore defaultStore];
    NSArray *items = [ps allItems];
    BNRItem *p = [items objectAtIndex:[indexPath row]];
    [ps removeItem:p];

    // We also remove that row from the table view with an animation
    [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]
                     withRowAnimation:UITableViewRowAnimationFade];
  }
}

- (NSInteger)tableView:(UITableView *)tableView
 numberOfRowsInSection:(NSInteger)section
{
  return [[[BNRItemStore defaultStore] allItems] count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView
         cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
  // Create an instance of UITableViewCell, with default appearance
  // Check for a reusable cell first, use that if it exists
  UITableViewCell *cell =
  [tableView dequeueReusableCellWithIdentifier:@"UITableViewCell"];

  // If there is no reusable cell of this type, create a new one
  if (!cell) {
    cell = [[UITableViewCell alloc]
            initWithStyle:UITableViewCellStyleDefault
            reuseIdentifier:@"UITableViewCell"];
  }
  // Set the text on the cell with the description of the item
  // that is at the nth index of items, where n = row this cell
  // will appear in on the tableview
  BNRItem *p = [[[BNRItemStore defaultStore] allItems]
                objectAtIndex:[indexPath row]];
  [[cell textLabel] setText:[p description]];
  return cell;
}

@end // expected '}'
  • 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-03T01:26:53+00:00Added an answer on June 3, 2026 at 1:26 am

    This line looks to be missing the end the of the block:

    [detailViewController setDismissBlock:^{[[self tableView]reloadData];
    

    should be:

    [detailViewController setDismissBlock:^{[[self tableView]reloadData]}];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting error C3095: 'Xunit::Extensions::InlineDataAttribute': attribute cannot be repeated in C++/CLI code but not
My timer not getting repeated please help here is the code timer = [NSTimer
I have seen some posts about navigation and breadcrumbs but did not find the
There's a strange issue with some of things I am using. Custom tableViewCell or
I have the following code repeated several times in a mvc app. public ActionResult
I'm using Stroustrup's swan book. I have run into a problem getting output from
We have a MySQL query, we used UNION ALL, We are getting two values
I am getting some strange character displays on hyper terminal, after establishing communication with
I have the following query: for each FacilityCode I am getting LastCompletedOn and LastEDAOn
I am using the likebox. I am getting some strange results. On Google chrome:

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.