iphone - pass NSMutableArray to another view giving null values -


i'm new ios development , want pass nsmutablearray 1 viewcontroller gives me null values

firstviewcontroller.h

@interface firstviewcontroller : uiviewcontroller  @property (nonatomic, retain) nsmutablearray *colorarray; -(ibaction)btn:(id)sender; 

firstviewcontroller.m

@implementation firstviewcontroller   -(ibaction)btn:(id)sender {     secondviewcontroller* secondviewcontroller = [[secondviewcontroller alloc] initwithnibname:@"secondviewcontroller" bundle:nil];      secondviewcontroller.animalarray = self.colorarray;      nslog(@"%@",secondviewcontroller.animalarray); // here not null      [self.navigationcontroller pushviewcontroller:secondviewcontroller animated:yes];  } 

secondviewcontroller.h

@interface secondviewcontroller : uiviewcontroller  @property (nonatomic, retain) nsmutablearray *animalarray; 

secondviewcontroller.m

i used nslog(@"animalarray:%@",self.animalarray); in viewdidload check values gives me null

is there i'm missing?

edit :

- (void)viewdidload {     [super viewdidload];      nslog(@"indidload%@",self.animalarray);   }  - (void)viewwillappear:(bool)animated  {     [super viewwillappear:animated];      nslog(@"inwillappear%@",self.animalarray);    } 

replace following method

-(ibaction)btn:(id)sender{       secondviewcontroller* secondviewcontroller = [[secondviewcontroller alloc] initwithnibname:@"secondviewcontroller" bundle:nil];          secondviewcontroller.animalarray=[[nsmutablearray alloc]initwitharray:self.colorarray];         [self.navigationcontroller pushviewcontroller:secondviewcontroller animated:yes];     } 

:) +1


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -