how to give one viewController add and edit functionality using storyboard

I am using storyboard and Xcode 5. I am new to ios. How can i give a same view controller two functionality User can add data and edit data as well. I have bar button in my navigation bar. DispalyDataController 1 : UITableView AddEditController 2 : Textfields, label simple form data Once AddEditController 2 is filled up then it must be displayed on tableview on DispalyDataController 1

I am using below code

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{

  AddEditController *controllerAddEdit;
 controllerAddEdit.arraypassed = self.dataArray;

   }

Answers


You need to set identifier by selecting an segue and move to attribute inspector

  -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
   if([[segue identifier] isEqualToString:@"Edit"] ){

  AddEditController *controllerAddEdit = segue.destinationViewController;
  controllerAddEdit.editModeOn = YES;
  controllerAddEdit.arraypassed = self.dataArray;

     }

    if([[segue identifier] isEqualToString:@"Add"] ){

    AddEditController *controllerAddEdit = segue.destinationViewController;
    controllerAddEdit.editModeOn = NO;

   }


  }

The problem is that your view controller is nil, you need to pull it out of the segue... Try this...

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    AddEditController *controllerAddEdit = (AddEditController *)[segue destinationViewController];
    controllerAddEdit.arraypassed = self.dataArray;
}

Need Your Help

Scrapy Spider - Saving data through Stats Collection

python scrapy scrapy-spider

I'm trying to save some information between the last runned spider and current spider. To make this possible I found the Stats Collection supported by scrapy. My code bellow:

BACnet Error: object: unknown-object

linux bacnet

I am using bacnet stack from http://bacnet.sourceforge.net/ with mitshubishi bacnet gateway ( model bac-hd150 ). The network is setup correctly and i can do bacnet who is and bacnet epic properly: