I have an array that I want to pass between viewcontrollers. From ViewControllerA to ViewControllerB but my result comes out nil.I have tried just about everything.
When I log destViewController.textArraysParsed in ViewControllerA I see the correct result.
Array (
Blake
)
But when I try to NSLog the array in ViewControllerB the array is Null? I tried the viewDidLoad, viewWillAppear and viewWillLoad methods to try NSLog the array but it comes out nil.
How can I use this array that I made up in ViewControllerA so I can access the array in ViewControllerB.
ViewControllerA Methods
ViewControllerA.h
#import <UIKit/UIKit.h>
#import "BSKeyboardControls.h"
#import "RegistrationBaseViewController.h"
@interface Register1ViewController : RegistrationBaseViewController <UITextFieldDelegate, UITextViewDelegate, BSKeyboardControlsDelegate, UIPickerViewDelegate, UIActionSheetDelegate, UIPickerViewDataSource> {
NSMutableArray *textArrays;
}
@property (nonatomic, retain) NSMutableArray *textArrays;
@end
ViewControllerA.m
textArrays =[[NSMutableArray alloc]initWithCapacity:10];
NSString *arrayString = [NSString stringWithFormat:@"%@", self.firstNameTxtFld.text];
[textArrays addObject: arrayString];
NSLog(@"Array %@", textArrays);
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:@"segRegister2"]) {
Register2ViewController *destViewController = segue.destinationViewController;
destViewController.textArraysParsed = textArrays;
NSLog(@"destViewController Array %@", destViewController.textArraysParsed);
}
}
WeakorStrongpointers?textArraysParsed's declaration?destViewControllernil?