Note that there are some explanatory texts on larger screens.

plurals
  1. POTable view doesn't store data
    primarykey
    data
    text
    <p>I have a problem of storing data on table view.</p> <p>It's a menu app that has a button which will pop over a table view and display them all the dishes they've ordered, I'm using the NSMutableArray to store the data, however whenever I close the table view, the data in the table will be reset to the initial status, which is the empty table.</p> <p>What should I do to solve this issue, thanks for any help!</p> <p>I'm using the FPPopover library to show the pop over table view, here's the code:</p> <pre><code>- (IBAction)revealOrderList:(id)sender { SAFE_ARC_RELEASE(popover); popover=nil; OrderListViewController *controller = [[OrderListViewController alloc] initWithStyle:UITableViewStylePlain]; UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:controller]; SAFE_ARC_RELEASE(controller); controller=nil; popover = [[FPPopoverController alloc] initWithViewController:nc]; popover.tint = FPPopoverDefaultTint; popover.contentSize = CGSizeMake(300, 500); [popover presentPopoverFromView:sender]; } </code></pre> <p>And in the pop over table view:</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; self.navigationItem.leftBarButtonItem = self.editButtonItem; orderList = [[NSMutableArray alloc] initWithObjects:@"One", @"Two", @"Three", nil]; //add the add button UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(insertNewObject)]; self.navigationItem.rightBarButtonItem = addButton; } - (void)insertNewObject { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Add new thing" message:@"" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil]; //Set the style of UIAlertView alert.alertViewStyle = UIAlertViewStylePlainTextInput; //Show the UIAlertView [alert show]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload