I have a problem storing the data in the table view.
This menu is a app that has a button that will pop up on a table view and display all the recipes that they have ordered, I am using NSMutableArray to store data, however when Also when I close the table view, then the data in the table will be reset to the initial position, which is the empty table.
What should I do to solve this problem, thanks for any help!
I'm using the FPPopover library to show pop on table view:
- Reveal (IBAction) Order: List: (ID) Sender {SAFE_ARC_RELEASE ( Popover); PopOver = nil; OrderListViewController * Controller = [[Order list ViUI controller 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 currentpop frameview: sender]; } and pop in table view:
- (zero) viewDidoadload {[Super ViewDidoadload]; Self.navigationItem.leftBarButtonItem = self.editButtonItem; Order list = [[NSMUTABELARRAL] Initwith Objects: @ "One", @ "Two", @ "Three", Nil]; // Add button UIBarButtonItem * addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem: UIBarButtonSystemItem Add target: auto operation: @selector (insertNewObject)]; Self.navigationItem.rightBarButtonItem = addButton; } - (void) insertNewObject {UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @ "Add New Thing" Message: @ "" Representative: Cancel YourTutton Title: @ "Cancel" Other Button Titles: @ "OK", zero ]; // Set the style of UIAlertView warning. AltertViewStyle = UIAlertViewStylePlainTextInput; // Show UIAlertView [Alert Show]; }
Your data is not stored by itself You can input your initial data into an array You may need core data to save new data, or you can save new data in any data or data base by NSUserDefaults in another way. There is a great tutorial in Tim Rodele that relates to the main data, this is the link: It also depends on the amount of data you are trying to save. The SQL data base will be better if it is in large quantity. Try either NSUserDefaults or key data, but you can not save new data just by setting an array. The array will only show the original data that you were charged through the code. Also save data is a very good example of apple try to search for sample code bird Better yet this is the link: Hope it helps you.
No comments:
Post a Comment