Friday 15 August 2014

iphone - NSMutable array adding entries? -


I'm very new to Objective-C and I'm building that app where records are kept. I have tried to make a savings method when I click on a savings button, although this does not display data when you press the button or it does this. The data is being shown in the table view

Here is the code for the Save button:

  - (zero) SevTivate: (ID) sender {LSAppDelegate * delegate = ( LSAppDelegate *) [[UIApplication shared applicant] representative]; NSMutableArray * Patients = Representative Husbands; UITextField * firstnameEntry = (UITextField *) [first name field description: 777]; UITextField * surnameEntry = (UITextField *) [surnameNameCell viewWithTag: 777]; UITextField * dobEntry = (UITextField *) [dobDateCellView Description: 777]; UITextField * homeNumberEntry = (UITextField *) [homeNumberCellView DescriptionTags: 777]; UITextField * mobileNumberEntry = (UITextField *) [mobileNumberCell viewWithTag: 777]; UITextField * Email Address Entry = (UITextField *) [Email Address: View Call WitTag: 777]; UITextView * addressEntry = (UITextView *) [see address call detailsTag: 777]; If (firstnameEntry.text.length> gt; {patient * newPatient = [[patient allotment] init]; NewPatient.patientName = firstnameEntry.text; NewPatient.patientSurname = surnameEntry.text; NewPatient.patientDoB = dobEntry.text; NewPatient.patientHomeNumber = homeNumberEntry.text; NewPatient.patientMobileNumber = mobileNumberEntry.text; NewPatient.patientEmail = Email Address Entry.Text; NewPatient.patientAddress = addressEntry.text; NewPatient.patientPicture = Zero; [Patients addObject: newPatient]; LSViewController * viewController = delegate.viewController; [ViewController.tableViewReloadData]; } [Delegate.navController popViewControllerAnimated: Yes]; }   

I have found that this issue is here

  if (firstnameEntry.text.length> 0) {   

Please

please

please

please

You need to make sure that your representative has a proper type of type And copying does not copy as copy and returns an array and does not have a NSMutableArray.

Although your data loading problem is probably not a simple issue, allocation / allocation of your array

Move this asset from your class to your class.

  @property (nonatomic, retaining) NSMutableArray * patients;   

Do not use copy and do not use NSArray. In addition, you need to make sure that you are instantiating an unstable array. DDLOD function in priority.

Before creating this visual controller, make sure you create an array in your class anywhere.

  self.patients = [[NSMutableArray alloc] init];   

It assumes that you are using ARC. If you are not using ARC, be sure to continue the array in the Delok method.

Generally if the data does not come in B-C then your array is zero or NSArray and NSMutableArray is not.

I will also add breakpoints to your above method and make sure that your tableview is not zero and that your array is not zero.

No comments:

Post a Comment